aspose file tools*
The moose likes Beginning Java and the fly likes Error  To run a java Program in another Dir Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error  To run a java Program in another Dir" Watch "Error  To run a java Program in another Dir" New topic
Author

Error To run a java Program in another Dir

Parveen Dalal
Greenhorn

Joined: Jun 24, 2007
Posts: 8
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
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
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"?


Ping & DNS - my free Android networking tools app
Parveen Dalal
Greenhorn

Joined: Jun 24, 2007
Posts: 8
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

Joined: Aug 16, 2005
Posts: 14270
    
  21

Parveen, if you type the following command in the command prompt window, what output does it give?

java -version


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
 
subject: Error To run a java Program in another Dir