aspose file tools
The moose likes Java in General and the fly likes How to include my own package in jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to include my own package in jar file" Watch "How to include my own package in jar file" New topic
Author

How to include my own package in jar file

Unnar Björnsson
Ranch Hand

Joined: Apr 30, 2005
Posts: 164
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?
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
"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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to include my own package in jar file
 
Similar Threads
class path
jar problem
about jar problem
NotSerializableException when i use rmiregistry
Are jars in EAR available