wood burning stoves 2.0
The moose likes Beginning Java and the fly likes Path to Java APIs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Path to Java APIs" Watch "Path to Java APIs" New topic

Path to Java APIs

jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
When we set path for jre, it sets path to the javac.exe file. So when we execute a class file, path will look in path variables and find javac.exe. How is the path to Java APIs set ? When we import a particular packagr, how does the computer locate where this package is located ? Is the path set automatically when we download and install jdk ?

Please explain.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 692
The java API code is in jar files. For the javac and the java commands to find the API class definitions, the jar files must be on the CLASSPATH which is different from the PATH. Use a Search for CLASSPATH to get examples of how to set it for your OS. Also look at the API doc for the javac and java commands to see the syntax for the -classpath option
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
In the Java� Tutorials, there is a page called Common Problems (here) and at the top its says something about "javac is not recognised."
That bit explains a bit about the PATH; there is a link in it to the installation instructions. Follow that link. There is tells you how to set the PATH permanently; follow those instructions to the letter. The tiniest spelling error and it won't work. Never mind that it says "optional;" do it!

There is probably no need to do anything with the CLASSPATH at this stage.
I agree. Here's the link: http://aspose.com/file-tools
subject: Path to Java APIs
It's not a secret anymore!