This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Path to Java APIs

 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 733
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic