Java/Maven/Tomcat: bootstrap class path not set in conjunction with -source 1.6
Asked Answered
M

2

11

So, I have more than one version of Java installed on the system (1.7 and 1.6). I need to use 1.6, so, being on Ubuntu, I did an update-alternatives --config java and changed it to the 1.6. Now java -version tells me I'm using 1.6.

So, I'm trying to build using Maven. If I do a mvn clean install, I end up with the following error:

[ERROR] bootstrap class path not set in conjunction with -source 1.6
/path/to/SomeResultSetStub.java:[32,7] error: SomeResultSetStub is not abstract and does not override abstract method <T>getObject(String,Class<T>) in ResultSet

I did some looking for that error, and it seems like I need to set some kind of BootClassPath somewhere, but I can't seem to find very explicit instructions for doing so.

Can anyone guide me through resolving the error?

Menedez answered 27/8, 2013 at 21:29 Comment(1)
Mr A, did you ever figure this issue out?Oona
L
10

When using javac in conjunction with -source you need to specify the bootstrap classpath to make sure no runtime errors occur when running your compiled code on a 1.6 jvm...

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

$ javac -target 1.7 -source 1.7 Main.java
$ javac -target 1.6 -source 1.6 Main.java
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
$ javac -Xbootclasspath:/usr/java/jdk1.6.0_29/jre/lib/rt.jar -target 1.6 -source 1.6 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.5.0_22/jre/lib/rt.jar -target 1.5 -source 1.5 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.4.0_30/jre/lib/rt.jar -target 1.4 -source 1.4 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.3.1_29/jre/lib/rt.jar -target 1.3 -source 1.3 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.2.2_017/jre/lib/rt.jar -target 1.2 -source 1.2 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.1.8_16/jre/lib/rt.jar -target 1.1 -source 1.2 Main.java
$ javac -Xbootclasspath:/usr/java/jdk1.1.8_16/jre/lib/rt.jar -target 1.1 -source 1.1 Main.java
javac: invalid source release: 1.1
Usage: javac  
use -help for a list of possible options
$ javac -Xbootclasspath:/usr/java/jdk1.1.8_16/jre/lib/rt.jar -target 1.0 -source 1.0 Main.java
javac: invalid target release: 1.0
Usage: javac  
use -help for a list of possible options

See http://vanillajava.blogspot.nl/2012/02/using-java-7-to-target-much-older-jvms.html for more information.

Langford answered 10/9, 2013 at 8:28 Comment(1)
Mr A is asking about this occurring from mvn clean install, not directly running the javac commandOona
C
2

The "bootstrap class path" error may only appear, if you are using a JDK other then version 6. as you said you want to use JDK 6, and you seem to use an other version, you should first change that. Apart from that though, your question would be a duplicate of: warning: [options] bootstrap class path not set in conjunction with -source 1.5

Carbonize answered 3/3, 2014 at 7:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.