user3623106
user3623106

Reputation: 3

Is it possible to configure javac version in maven compiler plugin without installing that specific Jdk version?

How maven Identify the JavaC loacation without installing that particular version?
For Example:my machine Have JDK 1.6 and didn't install JDK1.7 and set the configuration in pom.xml like mentioned below

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

Will it work without installing JDK1.7 version?

Upvotes: 0

Views: 89

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533570

It will if you install a later version. You need a JDK of at least version Java 7.

A down side for using a newer JDK is that the javac is not smart enough to prevent you using methods or class which were added after the version you specify. i.e. it ignores the @since

E.g. Stream is added in Java 8, but if you specify 1.7 it will still let you use it.

BTW You can get Java 8 update 5, and Java 9 EA.

Upvotes: 1

Related Questions