This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java

 
Viorel Dragos
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Viorel Dragos
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do "java -version" and "javac -version" report the same version?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Viorel Dragos
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic