• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Jar question

 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 5126
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: .
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 5126
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>will it work
Try it and see. Often faster and usually you get the correct answer.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic