aspose file tools*
The moose likes Beginning Java and the fly likes CLASSPATH question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "CLASSPATH question" Watch "CLASSPATH question" New topic
Author

CLASSPATH question

Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
I've downloaded a few Java programs that use other class libs. Now I had to add those to my CLASSPATH. The question I have is do I need to explicity add a JAR like this:
SET CLASSPATH=.;c:\jdk1.3\jre\lib\rt.jar;c:\jdk1.3\lib\tools.jar;c:\java\hsql\hsql.jar;f:\jaxp1.0.1\jaxp.jar;f:\jaxp1.0.1\parser.jar;%CLASSPATH%
Or can I just simply tell it what directory those JARS are in? My CLASSPATH is getting huge and I will probably download more Java stuff in the future that calls for adding yet more stuff to my CLASSPATH. This is not a real big issue but something that bugs me.
Keep in mind that everything is working, This is just something I'm concerned about.
Thanks,
Frank
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If you are using Java 2, you can just put the jarfiles in the lib/ext directory and they will be picked up automatically. For Java 1.1, you still have to have a long classpath.
If there are jars which you only use for one or two programs, you can add them to the classpath just before they are used either in a batch file/shell script:
<pre>
set CLASSPATH=mail.jar;activation.jar;%CLASSPATH%
java MyStuff
</pre>
or using the classpath command line parameter
<pre>
java -classpath "mail.jar;activation.jar" MyStuff
</pre>


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
I have Suns JDK 1.3 so would I put those jars in C:\jdk1.3\lib\ext ? That ext directory doesn't exist, do I just go ahead and create it and put my jars in there?
Thanks,
Frank
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CLASSPATH question
 
Similar Threads
problem running Client program
error with compiling servlet
adding jar file to web server
tomcat installation problem
Configuring Tomcat