128 reputation
7
bio website google.com
location Finland
age 28
visits member for 1 year, 11 months
seen Dec 8 at 11:01

.


May
22
awarded  Popular Question
Sep
24
comment Run different java based on command line parameter
However, I still don't understand why the compiling process does not take the JAVA_HOME variable in account while determining the compilation classpath. In this case the rt.jar did come from the JDK7 even if the JAVA_HOME was set. Similarly, the -Xbootclasspath option did not work by itself. Instead, setting JAVA_HOME to point to jdk6 was needed.
Sep
24
revised Run different java based on command line parameter
Add examples and the solution to the problem
Sep
24
awarded  Scholar
Sep
24
accepted Run different java based on command line parameter
Sep
24
comment Run different java based on command line parameter
This is indeed the correct answer to the question. However, it seems that my problem was different. Thank you in any case!
Sep
24
comment Run different java based on command line parameter
For the source to be compatible with java versions 6 and 7, I would need to add the method without the @Override annotation since it would then break with anyone compiling it with jdk 6.
Sep
24
comment Run different java based on command line parameter
The problem was resolved by adding -Xbootclasspath/a:$JAVA6_HOME/jre/lib/rt.jar to MAVEN_OPTS when compiling it while simultaneously using the source and target? parameters of the maven-compiler-plugin. The dependency comes straight from the JRE's own rt.jar`
Sep
24
comment Run different java based on command line parameter
Yes, this is what I thought. The project's source and target are both set to 1.6, but still it shows compilation error on my JDK7. This is because Java 7 has an added method CommonDataSource#getParentLogger(). The build runs fine if I first run update-java-alternatives --set java-6-sun and then mvn install, but not with update-java-alternatives --set java-7-oracle. Not with normal mvn install nor JAVA_HOME=... mvn install. Need to further investigate this..
Sep
24
revised Run different java based on command line parameter
deleted 258 characters in body
Sep
24
awarded  Editor
Sep
24
revised Run different java based on command line parameter
Add examples where this is not working
Sep
23
awarded  Student
Sep
23
asked Run different java based on command line parameter
Aug
22
awarded  Teacher
Aug
22
answered Lync (formerly Office Communicator) with pidgin-sipe => Read Error
Jan
9
awarded  Supporter
Dec
31
awarded  Autobiographer