Unable to locate the Javac Compiler using jre8 - java

I upgraded from Java7 to Java8
JAVA_HOME is C:\Program Files (x86)\Java\jre8
I am trying to run maven install on a plugin and I get the following error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project IcrMappingReport: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files (x86)\Java\jre8\..\lib\tools.jar
In all the projects I updated the JRE System Library to jre8 and also in
Windows -> Preferences -> Java -> Installed JREs to C:\Program Files (x86)\Java\jre8
Can anyone tell me the problem?

You need the Java8 JDK not the JRE.
JDK stands for Java Development Kit, (includes Compiler)
JRE stands for Java Runtime Environment, so it's just for running Java Programs.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Compiler is included in JDK, not JRE.
You need a JDK in order to compile java source code.

Related

No compiler is provided

I'm trying to run an AEM project. I successfully added it from cmd and now I'm trying to run it from InteliJ but I'm getting error.
Im trying with mvn clean install -PautoInstallPackage because I have running instance and want to build and package the whole project and deploy AEM with it.
Error is: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project aem-guides-wknd-full.core: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
javac 1.8.0_202
java version "1.8.0_321"
In env variables I set for User variables path > C:\Program Files\Java\jdk1.8.0_202\bin
And in System Variables in Path I added C:\Program Files\Java\jdk1.8.0_202\bin

Error when building Ionic APP using Cordova

(node:16112) UnhandledPromiseRejectionWarning: CordovaError: Failed to run "javac -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files (x86)\Java\jre1.8.0_171
I checked my user environment variable and I have the variable JAVA_HOME and set to "C:\Program Files (x86)\Java\jre1.8.0_171"
I also have C:\Program Files (x86)\Java\jre1.8.0_171 appended to the user environment variable PATH.
make sure you have a JDK installed
This is the relevant part of this error message. Your JAVA_HOME points to a Java Runtime Environment (JRE), not to a Java Development Kit (JDK).
javac is the Java compilation command, which Cordova is attempting to execute in this case. However, javac is not shipped with the JRE as it is a development tool.
You need to download and install a JDK and set JAVA_HOME to point to it

Gradlew unable to find a javac compiler

So I am trying to create a Workspace for eclipse from gradlew. And I am getting the following error:
Execution failed for task ':makeStart'.
> Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_131"
But I`ve set JRE_HOME and JAVA_HOME correctly(JAVA_HOME points to jdk folder and JRE_HOME to jre folder). But gradlew sees wrong jdk path. What may caurse this problem?
It is currently set to "C:\Program Files\Java\jre1.8.0_131"
That means you do not have a JDK installed, but a JRE, meaning, you only have the runtime environment but not the development kit that contains the compiler.
Install a Java JDK and set the environment accordingly.

Error when trying to debug my code

When I am trying to debug my code then I am getting the following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2
[INFO] ------------------------------------------------------------------------
[ERROR] **Failed to execute goal org.apache.maven.plugins:maven-compiler-**plugin:2.0.2:compile (default-compile) on project napier-am: Compilation failure
Unable to locate the Javac Compiler in:
C:\Program Files (x86)\Java\jre6\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Maven uses JAVA_HOME to access Java's location on the machine. In Your situation You point it to JRE not JDK. Set properly JAVA_HOME environment variable and it will work.
If You want to have different location/version used for Maven only You can edit mvn.bat file with something like this.
set JAVA_HOME=<path_to_other_jdk>
Your JAVA_HOME path is not set. You need to set it as C:\Program Files\Java\jdk <version>
Everything is said in the exception:
Unable to locate the Javac Compiler in: C:\Program Files (x86)\Java\jre6..\lib\tools.jar
Your maven task is trying to "compile" something, but can't find the Java compiler (JDK=Java Development Kit).
Please ensure you are using JDK 1.4 or above and not a JRE.
Instead it finds a JRE=Java Runtime Environment (which is used for running java programs, not compiling them).
you can change the location of your Java installation by setting the JAVA_HOME environment variable
You need to have a valid JDK version installed and your JAVA_HOME environment variable must point to this JDK folder.
Yeah Thanks for the clue..
Everyone is correct.
In my JDK version tools.jar was not available thats why I was getting this problem its not finding tools.jar, While JAVA_HOME varible is configured correctly.
Need to focus on only Tools.jar so that installed again java version (i am using java 6)
Now come on project--> go thru the build path and Make sure----
click on
installed jre
edit
jre home =C:\Program Files (x86)\Java\jdk1.6.0_25
give path accordingly for which Your OS is compatible

Building older NetBeans project in bash leads to error

I am opening an older NetBeans project and I want to build it using ant in bash with debian. However, when I try to run ant, I get this error
BUILD FAILED
/home/karelbilek/NetBeansProjects/oldProject/nbproject/build-impl.xml:528:
The following error occurred while executing this line:
/home/karelbilek/NetBeansProjects/oldProject/nbproject/build-impl.xml:261:
Unable to find a javac compiler; com.sun.tools.javac.Main is not on
the classpath. Perhaps JAVA_HOME does not point to the JDK. It is
currently set to "/usr/lib/jvm/java-7-openjdk-i386/jre"
What does that mean? What should I do? In "/usr/lib/jvm/java-7-openjdk-i386/jre" there seems to be an actual JRE when I look there, so what is the problem?
You're pointing to a JRE (Java runtime environment) but not a JDK (Java development kit).
Only the JDK contains the compiler (javac). The JRE is used for running Java programs but doesn't carry the extra components of the JDK (compiler etc.)
it happened for me and i got through it by installing the jdk
sudo apt-get install openjdk-7-jdk
After installing jdk, the classpath executed right

Categories