• 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

Setting environment variables

 
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!
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic