• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error while running a program

 
Moieen Khatri
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get this error while running any program


Thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15448
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Moieen Khatri
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...I ran set path=myjdkpathtillbinfolder from cmd and the issue is resolved now.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic