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?
Joined: Mar 03, 2004
"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: