aspose file tools*
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" java" Watch "Exception in thread "main" java" New topic
Author

Exception in thread "main" java

Viorel Dragos
Greenhorn

Joined: Nov 04, 2006
Posts: 7
i just get my first java class with javac
the source file is called vio1.java
javac generated vio1.class
when i try :
java vio1
i get this:
D:\ZX JAVA APL>java vio1
Exception in thread "main" java.lang.UnsupportedClassVersionError: vio1 (Unsuppo
rted major.minor version 49.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)

can you help me?
thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42624
    
  65
That is peculiar - usually this error points to a version mismatch between the class file and the JVM being used to run it. Do you have more than one JVM/JRE installed on your machine? Check that "java -version" and "javac -version" both report the same verison number.


Ping & DNS - my free Android networking tools app
Viorel Dragos
Greenhorn

Joined: Nov 04, 2006
Posts: 7
Thank you very much Ulf.
I have more than one version. java.exe exists also in a 'macromedia\..\jvm' folder.
What is the simple way to rezolve that?

thanks again,
vio
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42624
    
  65
Do "java -version" and "javac -version" report the same version?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14348
    
  22

Originally posted by Viorel Dragos:
I have more than one version. java.exe exists also in a 'macromedia\..\jvm' folder.
What is the simple way to rezolve that?

Make sure that you are using the right Java version when you compile and run things. Set the PATH environment variable correctly (see step 5 of the Installation Notes) so that Windows finds the JVM you've just installed instead of the JVM in the Macromedia folder.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Viorel Dragos
Greenhorn

Joined: Nov 04, 2006
Posts: 7
thanks everyone for help.
the problem was solved.
i removed the macromedia dreamweaver (demo version...) and clean the registry.
'hello word' run corectly now
vio
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" java