• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDK setup

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the command to set the environment variable in my computer to set JDK?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic