[Solved] MAVEN-COMPILER-PLUGIN Compile Error: FATAL ERROR: UNABLE TO FIND PACKAGE JAVA.LANG IN CLASSPATH OR BOOTCLASSPATH

When I used maven-compiler-plugin to add some environment variables, the codes is as following below. It was found that in the bootclasspath, two variables were separated by a semicolon, so an error was reported, as shown in the following figure.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.0</version>
    <configuration>
        <!-- 1.8 and 1.7 don't matter -->
        <source>1.7</source>
        <target>1.7</target>
        <compilerArguments>
            <!-- Do not write, only rt.jar by default -->
            <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
        </compilerArguments>
    </configuration>
</plugin>

 

 

 

Solution

The replacement code is shown below, using ${path.separator}the semicolon instead. Because under windowsand linuxunder, need to use different delimiters. windowsUse a semicolon, linuxuse a colon.

 

<bootclasspath>${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar</bootclasspath>

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *