Launch command mixes jdk 6 and jdk 7

I'm trying to use byteman inside my project.

I downloaded the example project https://github.com/adinn/byteman-rulecheck-maven-plugin-example and opened it as a maven project.

When I launch the test from idea, I have the following command:

D:\melusine\Java\jdk1.6.0_22\bin\java -ea -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0.2\bin" -Dfile.encoding=ISO-8859-1 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0.2\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0.2\plugins\junit\lib\junit-rt.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\charsets.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\deploy.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\javaws.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\jce.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\jsse.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\management-agent.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\plugin.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\resources.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\rt.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\ext\dnsns.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\ext\localedata.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\ext\sunjce_provider.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\ext\sunmscapi.jar;D:\melusine\Java\jdk1.6.0_22\jre\lib\ext\sunpkcs11.jar;D:\dev\byteman-rulecheck-maven-plugin-example-master\example3\target\test-classes;D:\dev\byteman-rulecheck-maven-plugin-example-master\example3\target\classes;D:\melusine\Maven\Repository\org\jboss\byteman\byteman\2.1.3\byteman-2.1.3.jar;D:\melusine\Maven\Repository\org\jboss\byteman\byteman-bmunit\2.1.3\byteman-bmunit-2.1.3.jar;D:\melusine\Maven\Repository\org\jboss\byteman\byteman-submit\2.1.3\byteman-submit-2.1.3.jar;D:\melusine\Maven\Repository\org\jboss\byteman\byteman-install\2.1.3\byteman-install-2.1.3.jar;C:\Program Files\Java\jdk1.7.0_51\lib\tools.jar;D:\melusine\Maven\Repository\junit\junit\4.8.2\junit-4.8.2.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 org.my.MyTest,myTest


java.lang.Exception: Unexpected exception, expected<java.lang.IllegalArgumentException> but was<java.lang.UnsupportedClassVersionError>

 at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:28)

 at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)



The jdk 1.6 is used but the tools.jar of the jdk 1.7.0 is referenced in the classpath. How can it is possible? The jdk 1.7 is only referenced with the IDEA_JDK, not in the project.

8 comments
Comment actions Permalink

Could your problem be related to this? http://devnet.jetbrains.com/thread/452767 This was IDEA 13 on Linux, but maybe the Windows launch scripts do something similar?

If Terminal tool works in Windows try running "set" command and see if classpath env var is set with IDEA jars.

0
Comment actions Permalink

Hello.

What is the value of Settings / Maven / Runner / JRE?

If it is not "internal" or JAVA_HOME, then it is probably defined in Project Structure dialog / SDKs. Make sure there is no 1.6 and 1.7 mixing there.

Regards,
Alexander.

0
Comment actions Permalink

To add after reading your post more carefully: actually whatever the Maven Runner is, check your project JDK anyway. Project Structure dialog / Project / Project SDK.

Regards,
Alexander.

0
Comment actions Permalink

The project JDK is 1.6.
The maven runner is set as : Use Project JDK (1.6).


The problem could be on the dependencies of the byteman project.

The byteman root pom (https://github.com/bytemanproject/byteman/blob/master/pom.xml) has this dependency :

             <dependency>
                 <groupId>com.sun</groupId>
                 <artifactId>tools</artifactId>
                 <version>1.6</version>
                 <scope>system</scope>
                 <systemPath>${tools.jar}</systemPath>
             </dependency>

Could the ${tools.jar} add the wrong tools.jar in the launch command?

0
Comment actions Permalink

Yes, it could, if ${tools.jar} is resolved to 1.7 version.

Alexander.

0
Comment actions Permalink

So the question is how and why this ${tools.jar} could be resolved as a 1.7 version as the project jdk is 1.6.

0
Comment actions Permalink

Yes, and this is most likely a question to the pom.xml, not to IDEA.

E.g. I see the following element in your pom:

<properties>
<tools.jar>${java.home}/../lib/tools.jar</tools.jar>
</properties>


Is that it? What is the path to java.home? Is it Ok to you? Can you change it?

Regards,
Alexander.

0
Comment actions Permalink

I've seen problems with IDEA not expanding properties defined in pom.xml via its launcher (http://devnet.jetbrains.com/thread/452806?tstart=30)

If that property isn't expanded by the IDEA launcher the executable stubs for javac the Windows JDK installer creates could be setting their own classpath to tools.jar ?
This behaviour would depend on the order you installed the JDKs (which jdk build the stub belonged to) rather than your java_home env var..?

0

Please sign in to leave a comment.