wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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

Error To run a java Program in another Dir

Parveen Dalal

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

Joined: Mar 22, 2005
Posts: 41155
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

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: 14074

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 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link: http://aspose.com/file-tools
subject: Error To run a java Program in another Dir
Similar Threads
sequencer = MidiSystem.getSequencer();
getting a java.lang.ClassNotFoundException on installing a setup file
Error in run a java program in another director