File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes CLASSPATH directive and system archives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "CLASSPATH directive and system archives" Watch "CLASSPATH directive and system archives" New topic
Author

CLASSPATH directive and system archives

Brian Lang
Ranch Hand

Joined: Oct 21, 2008
Posts: 43
How important is it to have 'tools.jar', 'rt.jar' or anyone of several jdk class archives in the CLASSPATH? Are these required or just additional libraries if you're developing certain applications? I've taken a peek into the files, they don't seem to have anything relevant to me. I can't find anything online to clarify this.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
Not at all. You don't need to do anything about them in the CLASSPATH. You used to (I am told) for older versions of Java, but not any more. All you need in your CLASSPATH for Java to work is the dreaded black spot (well a dot . or .; or ;. or ;.;) and you might only need that on Windows; my Linux box happily runs Java without anything in the system CLASSPATH at all.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3495
    
  13
Originally posted by Brian Lang:
I've taken a peek into the files, they don't seem to have anything relevant to me.


Seriously ? You don't use Strings or Objects or any other class from the standard API which are all in rt.jar.

You don't need to include it in your classpath because jar files in the JRE lib directory are read automatically.


Joanne
Brian Lang
Ranch Hand

Joined: Oct 21, 2008
Posts: 43
Originally posted by Joanne Neal:

Seriously ? You don't use Strings or Objects or any other class from the standard API which are all in rt.jar.

A bit harsh there, Joanne. I said I took a peek, I didn't spend alot of time looking at it. But I did see alot of things I'm not familiar with. While I am fairly competent with the language and syntax, and I can hack together an application to suit a purpose, I have alot to learn. Heck, before a couple of days ago I hadn't ever created my own JAR file!

Originally posted by Joanne Neal:

You don't need to include it in your classpath because jar files in the JRE lib directory are read automatically.

Thank you.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
The file you do want to peek into is called something like src.zip. Unzip it and you find the original code for all the commonly-used Java API classes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CLASSPATH directive and system archives