• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to convert java project into executable jar file

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 88
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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".
 
Narendra kodli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply

i got solution for this problem through netbeans tool...
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic