Issue when running PIT tests in Eclipse

177 views
Skip to first unread message

Dieter Willems

unread,
Jul 30, 2013, 7:37:53 AM7/30/13
to pitu...@googlegroups.com
Hi, 

with some help from Phil Glover, thank you Phil, I was able to see the pitclipse run with entry in my Eclipse IDE. 
But now I want to run the test I get the following issue:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Exception in thread "main"

in my projects pom.xml I specified the pitest plugin as follows:
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>0.29</version>
<configuration>
<targetClasses>
<param>com.energyict.heidelberg.*</param>
</targetClasses>
<targetTests>
<param>com.energyict.heidelberg.*</param>
</targetTests>
</configuration>
</plugin>

I'm running my eclipse in Java 1.6 and have a Eclipse Juno (4.2) as version to work with. Here we are using maven 2.2.1. 

Does somebody has any idea what I'm doing wrong, or what can be the cause of this issue?

Thanks in advance,
Dieter

Henry Coles

unread,
Jul 30, 2013, 3:06:37 PM7/30/13
to pitu...@googlegroups.com
Hi Dieter,

I think your JAVA_HOME environment variable might be pointing to a Java 5 install. PIT has to launch child jvm process - it will use the java executable at JAVA_HOME/bin.


--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dieter Willems

unread,
Jul 31, 2013, 4:58:59 AM7/31/13
to pitu...@googlegroups.com, henry...@googlemail.com
It's now indeed pointing to a 1.5 because we still need to code against a 1.5 due to our core is build on that.
But than I don't understand why PIT is running via maven and not in the IDE.

Phil Glover

unread,
Jul 31, 2013, 5:13:41 AM7/31/13
to pitu...@googlegroups.com
I guess the issue is that your code is now compiling in Eclipse with 1.6 but is then running PIT using 1.5 from JAVA HOME.

Might be worth trying to use the equivalent of the -target parameter to make your 1.6 jdk compile 1.5 compatible class files.

Dieter Willems

unread,
Aug 1, 2013, 3:27:05 AM8/1/13
to pitu...@googlegroups.com
My project in Eclipe is compiling against 1.5. I double checked that to be 100% sure. 

On the project, the Java Compiler is set to 1.5 and also the JRE System Library on the class path is set to jdk1.5. Both are the same as set on my JAVA_HOME environment variable.

Henry Coles

unread,
Aug 1, 2013, 10:03:02 AM8/1/13
to pitu...@googlegroups.com
Possibilities here are

a) JAVA_HOME is set to something pre Java 5, or pit is somehow picking up a <5 jvm from elsewhere
b) The project contains classes compiled to >5 binaries (in eclipse this is the "Generated .class file compatibility" setting, not the "Compiler compliance level" setting)
c) The classpath PIT is being launched with is being somehow polluted with >5 binaries from the eclipse plugin or elsewhere
d) Your classpath contains jars with >5 binaries that don't normally cause problems but are being picked up due to a change in order of the classpath

You've indicated that you've checked a,b

As a sanity check can you confirm that everything works via eclipse if you set JAVA_HOME to point at a 1.6 jvm?

Thanks

Henry




On 1 August 2013 08:27, Dieter Willems <dieter....@gmail.com> wrote:
My project in Eclipe is compiling against 1.5. I double checked that to be 100% sure. 

On the project, the Java Compiler is set to 1.5 and also the JRE System Library on the class path is set to jdk1.5. Both are the same as set on my JAVA_HOME environment variable.

--

Phil Glover

unread,
Aug 6, 2013, 12:26:19 PM8/6/13
to pitu...@googlegroups.com, henry...@googlemail.com
Dieter,

I have pushed an old version (0.30.1) of the plugin to a new update site.  This version should be compatible with JDK 1.5.  You will need to uninstall the current version of the plugin 0.30.2 first.


If support for JDK 1.5 is still a wider requirement I can try to remove the 1.6 dependency.

Phil
Reply all
Reply to author
Forward
0 new messages