1

I have developed a small project in eclipse which makes use of Java6. But I want to run the same project in hpux system which has java1.5. When I try to run it is throwing the error :

java.lang.UnsupportedClassVersionError:.

Then I have changed the eclipse Java compiler to java1.5 and jre to 1.5.0_12 then recompiled my project. After that I have deployed once again in hpux system but still it is throwing the same error. I used ant to compile in hpux system. It compiled successfully and produced jar. But while running it is throwing the same error.

Any help is highly appreciated. Many Thanks in Advance.

Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142
  • Which version does it say it is? e.g. 49.0 or 50.0. Can you give us the `java -version` on the server? – Peter Lawrey Dec 09 '11 at 16:10
  • Do you have a test suite as well for your app, and does the test suite fully pass on the hpux system, when compiled locally on that machine? – jefflunt Dec 09 '11 at 16:11
  • Does it tell you which class is the problem? Is it one of your classes, or is it a class from a third-party library that's causing the error? – Jonathan Dec 09 '11 at 16:13
  • Are you including some 3rd party library in your project? – Gray Dec 09 '11 at 16:14
  • are you sure that the UnsupportedClassVersionError is talking about one of your classes, and not about a class in a .jar file which is on the classpath? – stew Dec 09 '11 at 16:14

2 Answers2

0

You can use the target config option with a value of 1.5 so that the compiled classes are compiled to run against JVM 1.5. Also, make sure that 1.5 is the correct jvm on hpux by manually running java -version.

Read more details here

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
  • If the compiler is "java1.5" do you need to set the target as well? I suspect the versions are not what he thinks they are. – Peter Lawrey Dec 09 '11 at 16:13
0

Use the cross-comilation options when compiling, specifying a source/target of 1.5, and a bootclasspath pointing to a 1.5 rt.jar

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433