File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do I need to specify every .jar in classpath ?

 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about the following case :

In a "lib/" directory there are ---

lib/p1/P1_C1.class, P1_C2.class
lib/p2/P2_C1.class, P2_C2.class

Now I do ---

cd lib/

jar cvf p1.jar p1
jar cvf p2.jar p2

so in "lib/" there are 2 jars p1.jar, p2.jar.

In my CLASSPATH can I simply add "lib/" or do I have to add "lib/p1.jar;lib/p2.jar", assuming both p1.jar and p2.jar are needed for the code to work ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add each individual jar file.
 
Nigel Browne
Ranch Hand
Pie
Posts: 682
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do not want to add each individual .jar file onto your CLASSPATH you can install them in the lib directory of your JRE and then they should be found automatically.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nigel Browne:
If you do not want to add each individual .jar file onto your CLASSPATH you can install them in the lib directory of your JRE and then they should be found automatically.


The lib\ext directory. Yes, you can do that -- but often this just leads to more confusion, along the lines of "WHy does this work on my computer, but not my friend's computer?"
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:


The lib\ext directory. Yes, you can do that -- but often this just leads to more confusion, along the lines of "WHy does this work on my computer, but not my friend's computer?"


or, "why does it not pick up the class from this new version" as /lib/ext takes presedence
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic