java.lang.UnsupportedClassVersionError: LoggerClient (Unsupported major.min

when i run custom logger i am getting following erro:

java.lang.UnsupportedClassVersionError: LoggerClient (Unsupported major.minor version 49.0)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:539)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)

at java.net.URLClassLoader.access$100(URLClassLoader.java:55)

at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Exception in thread"main"

D:\>java -version

java version"1.4.2_13"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_13-b06)

Java HotSpot(TM) Client VM (build 1.4.2_13-b06, mixed mode)

import com.standardandpoors.framework.logger.SPLogger;

publicclass LoggerClient

{

privatestaticfinal SPLogger log= SPLogger.getLogger(LoggerClient.class);

public LoggerClient()

{

log.debug("inside constructor");

}

publicvoid testLogging ()

{

log.debug("inside method....");

if (true)

{

log.fatal("this is a fatal error");

}

log.debug("testLogging code finished");

}

publicstaticvoid main (String[] args)

{

log.info("inside main code executing....");

LoggerClient logHelp =new LoggerClient();

logHelp.testLogging();

log.info("info message");

log.info("Welcome");

log.debug("debug message");

}

}

[3025 byte] By [kasima] at [2007-11-27 11:16:48]
# 1

> Unsupported major.minor version

This means the the version of your JRE is lower than the compiled code. It's possible that the code was compiled with JDK 5 or 6 and you try to run it with JRE 1.4. Try to compile the code with JDK 1.4 or lower the compiler level of your JDK 5/6 compiler to 1.4.

bytoa at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 2

> > Unsupported major.minor version

>

> This means the the version of your JRE is lower than

> the compiled code. It's possible that the code was

> compiled with JDK 5 or 6 and you try to run it with

> JRE 1.4. Try to compile the code with JDK 1.4 or

> lower the compiler level of your JDK 5/6 compiler to

> 1.4.

my java version shows that 1.4.2_13 as shown above. also i have compiled in eclipse which uses same jdk. where/how can i change the jre?

earlier i was using jre1.6, but i made my classpath and path set to 1.4.

1)where do i need to do the changes.

2) where can i see the jre version?

kasima at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 3

Eclipse doesnt use the systems classpath. Go to preferences and seach for installed jres. You can install seperate java versions, set it up on eclipse and then switch from project to project, whatever version you need. or you can just install the latest java version and lower the compiler level (go to preferences and search for java compiler -> compiler level).

bytoa at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 4

> my java version shows that 1.4.2_13 as shown above.

> also i have compiled in eclipse which uses same jdk.

Eclipse doesn't use the JDK, it has its own compiler. It uses the JRE

> where/how can i change the jre?

> earlier i was using jre1.6, but i made my classpath

> and path set to 1.4.

> 1)where do i need to do the changes.

> 2) where can i see the jre version?

As well as setting JRE version, you need to change your compiler compliance settings. Window->Preferences->Java->Compiler

georgemca at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 5

even i have comipled without using eclipse ie in texpad and tried to run in command still i am getting the same error?

kasima at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 6

What version of javac?

georgemca at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 7

> As well as setting JRE version, you need to change

> your compiler compliance settings.

> Window->Preferences->Java->Compiler

oh thats great, thanks a lot, it was point to 1.5 in eclipse> Window->Preferences->Java->Compiler. I changed to 1.4. Now it is working fine.

kasima at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 8

> What version of javac?

how can i view version of javac? if i say javac -version in command prompt it says javac: invalid flag: -version

kasima at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 9

javah -version

tschodta at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 10

Also, you should be able to see the major & minor version usingjavap -verbose classfile

on the resulting class file.

Does not seem to work for me tho so I useod -txC classfile|head -1

and decode the output according to 4.1 of http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html

tschodta at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...
# 11

javah version "1.4.2_13"

thanks.

kasima at 2007-7-29 14:21:13 > top of Java-index,Java Essentials,New To Java...