I am trying to clean maven project using IntelliJ on mac by running below command but getting error. Please suggest what needs to be done to fix this
./mnwn clean package
Error : "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?"
Thanks
The issue is not related to IntelliJ IDEA, you should get the same behavior when you run this command in the system Terminal.
To fix the issue install any JDK on your system and make sure the bin subdirectory of the JDK home directory is added to PATH environment. You may also want to set JAVA_HOME environment variable pointing to this JDK installation home directory.
To verify that it works run java -version in the system Terminal. Make sure it prints the correct Java version of the JDK and not a JRE.
I was facing similar error while workspace setup on a new MAC system.
I was initially referring "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin" as JAVA_HOME path but it was not correct.
The correct JDK path was "/Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home". If you JDK with default installation path on MAC then cross check your JAVA_HOME. It might help you to solve your problem.
Installed JRE pointing to JDK & Libraries pointing to jre[Please note- there solutions out there Eclipse, but I'm using Sprint STS]
Spring Tool Suite Version: 3.9.3.RELEASE
Apache Maven 3.2.5
Java- 10.0.1
OS - Windows 10
Tomcat 8.5
I have already verified Installed JRE has a JDK entry. Have verified JAVA_HOME and Path environment variables.
Maven Clean & Validate works. Maven Compile does not work.
Gives me error - "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? "
Can someone please help?
Your workspace needs to be configured with a JDK.
Goto Preferences->Java->Installed JREs and Add your JRE there. Point at a JRE (with a JDK).
Then right-click on your project and select Build Path->Configure Build Path->Libraries->Add Library to make sure that JRE is associated with your project.
I faced same error while using spring tool suite 4 IDE.
To resolve these issues, follow these steps:
Right click on project
Select Build path option
Click on configure Build path
Go to libraries tab
Click on Add Library option
Select JRE System Library
Select Alternate JRE option
Click on installed JRE's button
Click on ADD
Select Standard VM
Click on directory
Select the path to JDK
Click Apply & Close.
That's it, issue was resolved and maven build was successful.
I hope this works for eclipse too. It worked for me.
I'm using Eclipse Mars and I can't see 1.8 in the compiler compliance level menu.
Prehaps, it is because I used this option to import all my plugins from my Eclipse Kepler installation. Maybe it also import preferences that causes this problem.
I added the jdk 1.8 in the Installed JREs.
I tried to delete the .preferences folder and restart my eclipse but I still have the problem.
Any ideas?
EDIT : I tried to check for updates but no updates were found
You need to select the appropriate java version in the project's/ build path first
If you want to apply it globally you not only have to add a 1.8 JRE but also select it as default.
I had the same problem. Probably it was because I originally installed Eclipse Kepler (which doesn't support java 1.8. compiler) and then updated it to Luna first and then to Mars. I had to completely uninstall Eclipse and reinstall newest version.
If you have a shortcut to start eclipse, edit it and add -vm [path-to-jdk-1.8]/jre/Javaw.exe after the path to eclipse.exe .
You can also add the code to your eclipse.ini but make sure it is the very first line. Afterwards you might be able to chose 1.8 in the global compliance level
While importing projects into eclipse i have this error:
Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory. Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.11-all.zip'.
As I have checked i need to set JAVA_HOME (i have the JDK on my computer), but i dont have a clue how to do that.
I had lots of similar problems and I think that the best solution is to specify JDK location manually. In order to do it:
Add two files to project root folder
gradle.properties:
org.gradle.java.home=C:/Program Files/Java/jdk1.7.0_03
and local.properties:
org.gradle.java.home=C:/Program Files/Java/jdk1.7.0_03
You should change org.gradle.java.home value to JDK path in your system. If you will have the same problem with android SDK add sdk.dir=/Users/alonzilberman/Android/adt-bundle-mac-x86_64-20130917/sdk to your local.properties.
After adding files refresh gradle build.
I got the same message while trying to build a project in Android Studio.
After hours of research, trying different versions of JDK (from 8 to 6) I found this answer that fixed my problem:
https://discuss.gradle.org/t/mac-gradle-issues-with-finding-using-jdk-7-the-usual-answers-to-this-question-arent-working-expert-required/2553/24
The reason was that the AUSKey package installed a tools.jar in /Library/Java/Extensions directory that derailed Gradle looking for the compiler. Removing that file fixed the problem and I can now build in Android Studio.
Create a new system variable called JAVA_HOME and add
C:\Program Files\Java\jdk1.8.0_25
It's because your environment variable isn't pointing to your jdk folder. Don't point it to your bin folder.
I'm trying to install Java to use Eclipse (I followed all instructions to install Java and Eclipse) but my Eclipse is not starting due to some bad configuration I guess. I can't figure out why it's not working for me.
Eclipse Installation:
Extracted Eclipse at C:\eclipse
Created a shortcut to my desktop having target C:\eclipse\eclipse.exe
When I try to run Eclipse with this shortcut, I see following Eclipse splash screen for a second and it disappears. Eclipse does not start at all.
JAVA Installation:
Installed JDK at C:\Program Files\Java\jdk1.7.0_10
Installed JRE at C:\Program Files\Java\jre7
Environment Variables Configuration:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_10
PATH = C:\Program Files\Java\jdk1.7.0_10\bin;
I tested my Java installation using the console and figured out this issue but I don't know how to fix it, and I guess this is causing Eclipse not to start.
Problem:
Go to Eclipse folder, locate eclipse.ini file, add following entry (before -vmargs if present):
-vm
C:\Program Files\Java\jdk1.7.0_10\bin\javaw.exe
Save file and execute eclipse.exe.
please try to execute java from
C:\Program Files\Java\jdk1.7.0_10\bin
i.e from the location where java is installed.
If it is successful, it means that the error lies somewhere in the classpath.
Also, this guy seems to have had the same problem as yours, check it out
Check that downloaded eclipse/JDK/JRE is compatible with your processor/OS architecture that is are they 32bit or 64bit?
Not able to run Appium {“message”:”A new session could not be created. (Original error: ‘java -version’ failed
I used Jdk 1.8 and JRE 1.8, Classpath is also set properly but I observed that Java command gives Error to initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)
Solution:
Uninstalled JRE and JDK completely
Installed JRE 1.8 then
Installed JDK 1.8
Set Classpath
check Java command works or not and its working
also able to execute the Appium program thru Eclipse Kepler Service Release 2 with JDK1.8 support
I had the same error in my case was when I needed to update jdk 7 to jdk 8, and my bad was just I installed jdk8 and I never installed jre8, only that, the error was solved immediately when I installed jre8.
Try placing the desired java directory in PATH before not needed java directories in your PATH.
I had the same issue on Windows 7 and I had to install both JDK and JRE and it's a success.
I faced the same problem,Eclipse splash screen for a second and it disappears.Then i noticed due to auto update of java there are two java version installed in my system. when i uninstalled one eclipse started working.
Thanks you..
I've observed this with STS and Eclipse and running java from CMD too on Windows 7/8/10 and following was my simple solution:
Actually, when I installed JDK 8 and STS/Eclipse it created one directory i.e. C:\ProgramData\Oracle\Java\javapath with the following files:
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\ProgramData\Oracle\Java\javapath\javaw.exe
C:\ProgramData\Oracle\Java\javapath\javaws.exe
Along with that, it appended Path Environment variable of System with this location C:\ProgramData\Oracle\Java\javapath
I've just removed above entry from Path Environment variable of System and added the location of the actual JDK instead i.e. C:\Program Files\Java\jdk1.8.0_131\bin
Now that is not necessary to add that -vm option in eclipse.ini or
SpringToolSuite4.ini either.
I just spent about 1 hour to figure out possible solution for the same error.
So what I did under MS WIndows 7 is following
Uninstall all Java packages of all versions.
Download last packages Java SE or JRE for your 32 or 64 Windows and install it.
First install JRE and second is Java SE.
Open text editor and paste this code.
public class Hello {
public static void main(String[] args) {
System.out.println("test");
}
}
Save it like Hello.java
Go to Console and compile it like
javac Hello.java
Execute the code like
java Hello
Should be no error.
sometime you missed some file like I missed my one file rt.java
so better to check yours .........
C:\Program Files\Java\jdk1.8.0_112\jre\lib
0
I just spent about 1 hour to figure out possible solution for the
same error.
So what I did under MS WIndows 7 is following
Uninstall all Java packages of all versions.
Download last packages Java SE or JRE for your 32 or 64 Windows and
install it.
First install JRE and second is Java SE.
List item
Below error is thrown when there are multiple versions of jdk on your machine:
error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
so for this Just use below:
set PATH="JDK bin path" in cmd
I had a same issuse, my file location was in D-drive, and then i shifted to the c-Drive and it works.