File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Error While running Java Program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error While running Java Program" Watch "Error While running Java Program" New topic
Author

Error While running Java Program

Ratheesh Narayanan
Ranch Hand

Joined: Oct 30, 2004
Posts: 38
Hi,

Can anyone help me? I have an exception message when i execute a simple java program to display hello world in command prompt. I am using java 1.5.0_05 currently for the execution. Let me put the exeception message below:
----------------------------------------------------------------------------
E:\>java Hello
Exception in thread "main" java.lang.UnsupportedClassVersionError:
r.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Sour
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 Metho
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Sourc
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
----------------------------------------------------------------------------
Here is the code:
public class Hello
{
public static void main(String s[])
{
System.out.println("Hello World");
}
}

Thanks in Advance,
With regards,
Ratheesh Narayanan
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

That error message means that you have a class that you compiled with Java 5.0, and you are trying to run it with an older Java version.

Make sure you uninstall the older Java version, or make sure you are running it with Java 5.0.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Bill Johnston
Ranch Hand

Joined: Nov 17, 2005
Posts: 201
At your command prompt, key in:

E> java -version

... What do you get?


~Bill
 
jQuery in Action, 2nd edition
 
subject: Error While running Java Program
 
Similar Threads
NoClassDefinitionFound...
Can't even run a "Hello World" program
Do I need to reinstall Java?
Error by compiling textfile Could not find the main class: HelloWorldapp. Program will exit
Exception in thread "main"