• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting environment variables

 
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!
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to set your classpath

Go to the path
D:\Program Files\Java\jdk1.6.0\bin\

and type

set classpath D:\Program Files\Java\jdk1.6.0\lib (or whereever you want to put your classes)

[ July 18, 2007: Message edited by: vanlalhmangaiha khiangte ]
[ July 18, 2007: Message edited by: vanlalhmangaiha khiangte ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do NOT set your CLASSPATH, and do NOT set it to JDK/lib. Ever. Nobody ever do this. Seriously. Ugh.

There are a few different things that might be going on -- if you tell us the exact text of the error message we can tell you the proper way to deal with it.
 
Ajay Divakaran
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error when I invoke java <classname>
Exception in thread "main" java.lang.UnsupportedClassVersionError.<classname>< Unsupported major.minor version 49.0>
 
Amit Kumargupta
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have multiple Java versions installed in your machine just delete the old version and try with new version JDK 1.5 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic