No Compiler Is Provided in This Environment. Perhaps You Are Running on a Jre Rather Than a Jdk

Eclipse/Maven error: No compiler is provided in this environment

Go to Window → Preferences → Java → Installed JREs.

And see if there is an entry pointing to your JDK path, and if not, click on Edit button and put the path you configured your JAVA_HOME environment.

Maven error :Perhaps you are running on a JRE rather than a JDK?

Apparently, it requires tools.jar file inside the lib folder of my $JAVA_HOME. I did not have the lib folder, so I reinstalled my jdk using command

apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib

Also, this link may help some people.

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

You need not configure "maven.terminal.useJavaHome", it depends on java.home, but java.home is deprecated for now.

Official docs:

If you need to compile your projects against a different JDK version,
it's recommended you configure the java.configuration.runtimes
property in your user settings, eg:

"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "/path/to/jdk-8",
},
{
"name": "JavaSE-11",
"path": "/path/to/jdk-11",
},
{
"name": "JavaSE-18",
"path": "/path/to/jdk-18",
"default": true
},
]

But it will not modify the Path environment variable in the terminal, it will affect the Java extension, for example, the Run Java button.

And from the picture in your question and your comments, you need to download and install a JDK first and remember to add the bin folder of JDK to the Path environment variable.

Error Perhaps you are running on a JRE rather than a JDK?

In your Intellij in main menu go to this path:

File -> Project Structure -> Platform Settings -> SDKs

In order to add new JDK click on + button and add JDK from your directory or just download a new one.

After that set your project's JDK:

File -> Project Structure -> Project Settings -> Project

In this path check the Project SDK and Project language level sections.


Two other important settings you should check for JDK for Maven that running in Intellij:

First:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing

Here in this path check JDK for importer section.

Second:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner

Here check JRE section.



Related Topics



Leave a reply



Submit