wood burning stoves 2.0*
The moose likes Java in General and the fly likes How to convert java project into executable jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to convert java project into executable jar file" Watch "How to convert java project into executable jar file" New topic
Author

How to convert java project into executable jar file

Narendra kodli
Greenhorn

Joined: Dec 24, 2011
Posts: 22
Hello all,

I have completed a project in java and now i want to make it an executable jar file.
i have followed some steps to make a jar file for a single java class and now i want to know how to add all java classes from different packages and also how to add all my library files into a single executable jar file??
i have added main class and classpath in manifest file, but still i am not getting the jar file

can anyone help me to solve this problem

Thank you
RatiKanta pal
Ranch Hand

Joined: Nov 13, 2011
Posts: 62

Start Command Prompt.
Navigate to the folder that holds your class files:
--C:\>cd \mywork
Set path to include JDK’s bin. For example:
--C:\mywork> path c:\Program Files\Java\jdk1.5.0_09\bin;%path%
Compile your class(es):
---C:\mywork> javac *.java
Create a manifest file:
---C:\mywork> echo Main-Class: DanceStudio >manifest.txt
Create a jar file:
---C:\mywork> jar cvfm DanceStudio.jar manifest.txt *.class
Test your jar:
---C:\mywork> DanceStudio.jar

Jar Link
Narendra kodli
Greenhorn

Joined: Dec 24, 2011
Posts: 22
Thanks for the reply..
i have followed the same steps to create jar file, but i want to know how to add classes from different packages and also other jar files that i have used for my project,
which also include database connection
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Narendra kodli wrote:Thanks for the reply..
i have followed the same steps to create jar file, but i want to know how to add classes from different packages and also other jar files that i have used for my project,
which also include database connection


Probably you need to play around with JAR's manifest file. Google for "Java jar manifest".


PM Me If You Want to get Urgent Help on Java Programming
Narendra kodli
Greenhorn

Joined: Dec 24, 2011
Posts: 22
Thanks for the reply

i got solution for this problem through netbeans tool...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert java project into executable jar file
 
Similar Threads
MySQL with ant: can not find driver class
Executable Jar File
Windows Executable
Creating .exe from class file
creating win exe file from java