• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDK setup

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the command to set the environment variable in my computer to set JDK?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Windows?

You probably want to set the path variable to include the bin folder of the JDK, and set the classpath variable to include your programs.

The path never changes (unless you want to switch between JDKs) so it's safe to set it in the system. In Windows, start / settings / control panel / system / advanced / environment variables button. Then add the full path to the bin directory to the path.

I change the classpath often depending on the program I'm running. I often have a batch file just for one program that adds the necessary jars and other projects I'm working with. For simple exercise programs, it may be enough to have "." in the classpath for current directory, so make sure the "." is in the system defined classpath.

See if this tutorial makes things clearer or worse. Follow the link at the beginning to Sun's setup pages.
[ July 18, 2007: Message edited by: Stan James ]
 
Ajay Divakaran
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set the path variable to the bin directory ie D:\Program Files\Java\jdk1.6.0\bin and JAVA_HOME to the parent folder ie D:\Program Files\Java\jdk1.6.0\
I can successfully compile my program using javac but when i run it using java it always gives me some class error!!
I've tested it with some basic programs such as only a single println statement but it does'nt run.
But, it works fine from within the java's bin folder when the .class file is present there!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic