• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to include my own package in jar file  RSS feed

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have program that uses a class file in a specific package named MyPackage which works except when I bundled in a JAR file the job that requires the clas s file in MyPackage doesn�t work.
I tried including the folder MyPackage into the JAR file like this:
Jar cfm Program.jar Manifest.mf *.class MyPackage
Where the Manifest.mf contains only the Main-Class header. It doesn�t work.
Do I need to do something with the manifest file for it to work?
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"It doesn't work" is not very informative.
What are you trying to do? What error do you have?
No jar file is created?
The jar file is created but the following command:
> java -jar Program.jar myPackage.MyClass
outputs an error at the console? Which one?
You have another problem?

Anyway here are some pointers:

1- By convention package names must start with a lowercase letter
while class names must start with an uppercase letter.

2- Have a folder structure like this:


3- Then do the following:


Where myManifest.txt should have the following line:


4- Then execute it:



Regards
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!