Home>Article>Java> jdk becomes jre after Maven refreshes

jdk becomes jre after Maven refreshes

巴扎黑
巴扎黑 Original
2017-06-26 09:56:26 2527browse

Maven has two ways to set jdk, setting in setting.xml or pom.xml, and there are two ways to set it in pom.

If set in setting.xml, it is set as a global variable. Add the following profile element under the profiles element in the setting.xml file

 jdk18  true 1.8   1.8 1.8 1.8  

Then if you set it in the pom.xml of each project, it will be a local variable.

   org.apache.maven.plugins maven-compiler-plugin  1.8 1.8 UTF-8    

Also

 UTF-8 UTF-8 1.8 1.8 1.8 

All of the above can specify the jdk version

But there is one more The problem is that after maven specifies jdk, he can only use the javase1.8 he specified. If the jdk setting is not correct at this time, something like this will happen

used lib is the jre version. If maven is used for packaging and other operations at this time, it will prompt

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Open Window - Preferences - java - Installed JREs

I found that jre is used instead of jdk

At this time You need to add jdk and switch to jdk

, but an error is still reported when compiling.

Look back at the project's java build path

I found the above javaSE-1.8 (jre1.8.0_131), which uses It's jre instead of jdk

and there is no jdk option when opening the option.

This is because jre was used instead of jdk at the beginning, causing the default javaSE to use jre.

You only need to delete the jre JREs in the Installed JREs

The above is the detailed content of jdk becomes jre after Maven refreshes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn