File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes error while running a program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "error while running a program" Watch "error while running a program" New topic
Author

error while running a program

Moieen Khatri
Ranch Hand

Joined: Nov 27, 2007
Posts: 144
Hi,

I have jdk 1.4 installed on my computer.Whenever I write a sample program I'm able to compile it but on running the program from cmd prompt it gives the following error message:


Exception in thread "main" java.lang.UnsupportedClassVersionError: DateTest (Uns
upported 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 someone please advice?

Thanks in advance
Moieen Khatri
Ranch Hand

Joined: Nov 27, 2007
Posts: 144
I get this error while running any program


Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14144
    
  18

The error message means that you have compiled your code with JDK 1.5, and now you are trying to run it on Java 1.4.

You can run Java programs compiled with an older version on a newer version, but not the other way around. (So compiling on JDK 1.4 and running on Java 5 works, but not compiling on JDK 1.5 and running on Java 1.4).

If your code needs to run on Java 1.4, then use JDK 1.4 instead of JDK 1.5.


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

Joined: Nov 27, 2007
Posts: 144
thanks...I ran set path=myjdkpathtillbinfolder from cmd and the issue is resolved now.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error while running a program