• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar question

 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends
I have created a java application which I now need to jar up and make the client run usign command prompt. Now these classes inorder for them to compile correctly they need loads of other IBM Jars. And to run they need other set of jars what is the best way to create my application jar. I do not want to have any third party jars inside my application jar as it would be inflexible. What is the general procedure regarding creating application jars and third party jars
Any help will be much appreciated..
Regards
Farouk
 
Norm Radder
Bartender
Posts: 1240
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way would be to use the manifest file's Class-Path: entry to point to the other jar files. If all the jar files were in the same folder, you could use . ie Class-Path: .
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First club your custom application in a jar file. And put other required jars (IBM’s jars and jars required by IBM’s jars) to JAVA_HOME\jre\lib\ext folder.

Whatever jars you put in JAVA_HOME\jre\lib\ext folder is automatically available runtime. No need to include them in classpath.
 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help
So for run time jars I am sorted what about compiled classes as my applicaiton requires certain jars from IBM to even compile. So if I jar my class files only without IBM Jars which I used to compile will it work
 
Norm Radder
Bartender
Posts: 1240
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>will it work
Try it and see. Often faster and usually you get the correct answer.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Ant to build and create the (runnable) application JAR (including the manifest). You can always have separate targets to build with and without the third party JARs.
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chetan Parekh:
Whatever jars you put in JAVA_HOME\jre\lib\ext folder is automatically available runtime. No need to include them in classpath.


That is seriously flawed advice. Let's assume you overcome the practical problems in updating a user's JRE folder. Those jars can run unrestricted regardless of any security settings. The extension folder is for bona fide Java extensions. Use -classpath setting of java and javac and the Class-Path setting in you manifiest for jar files that need to designate dependent jars.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic