• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error To run a java Program in another Dir

 
Parveen Dalal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
My java default directory is C:\Program Files\Java\jdk1.6.0_02
and i saved a program in d:\Xyz.java and also i set the enviromental variable "Path" to "C:\Program Files\Java\jdk1.6.0_02\bin" and after that i complie the program javac Xyz.java it work but when i tried to run the program it shows an error. so please help me to sort out this error. thanks in advance. the error is


Exception in thread "main" java.lang.UnsupportedClassVersionError: Xy
ted major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like an earlier JDK version (not 6) is used to run the program. What command are you using to run it? Does it work if you type "C:\Program Files\Java\jdk1.6.0_02\bin\java Xyz"?
 
Parveen Dalal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly sorry for writing my problem in two places next time i remember this thing.
actually i saved a file in d: directory so "C:\Program Files\Java\jdk1.6.0_02\bin\java Xyz" is not working but if i save a program in "C:\Program Files\Java\jdk1.6.0_02\bin\Xyz.java" directory then it works
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parveen, if you type the following command in the command prompt window, what output does it give?

java -version
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic