BUILD FAILED in android project - java

compile:
BUILD FAILED
D:\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:601: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:720: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:734: Unable to fin
d 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\jre7"
path is ::C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\Wind
owsPowerShell\v1.0\;
C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.6\;
D:\Progr
am Files\nodejs\;E:\practicum\Softwares\apache-ant-1.9.3\bin;
E:\practicum\Softwa
res\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\pl
atform-tools;
E:\practicum\Softwares\adt-bundle-windows-x86_64-20131030\adt-bundl
e-windows-x86_64-20131030\sdk\tools
;C:\Program Files\Java\jdk1.7.0_25\lib;C:\Pro
gram Files\Java\jdk1.7.0_25\bin;
C:\Users\srinivas\AppData\Roaming\npm;
Please tell me how to refix the problem.

Make "JAVA_HOME " variable point to a JDK installation, not JRE.
You are referencing the runtime environment, not the development kit - it can't find the compiler because its not there.
It should be something like this:
"C:\Program Files\Java\jdk1.7.0_51"
However the path and the JDK version may vary on your system.

As it says
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre7"
Your JAVA_HOME is set to JRE it should be set to JDK
set your JAVA_HOME to
C:\Program Files\Java\jdk1.7.0_25\bin;
or to the version of jdk is available

Related

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.

Installing ANT - unable to locate tools.jar

I am trying to install Apache Ant on my system, while setting the path variable. I have jdk installed on my system. I set the ANT_HOME environment variable to where ant is located on the system, i.e, F:\apache-ant-1.9.6\, and the path variable to F:\apache-ant-1.9.6\bin.
But when I test if ANT is installed correctly by typing ant -version on cmd , I get this error:
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.
0_25\lib\tools.jar
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
While reading this answer, they say tools.jar in included in jdk and not jre. But I have correctly installed jdk, and set the environment variable correctly for that too.
When you actually go to the location specified by ant build it'll not have tools.jar.
The error is misleading and wrong. It is just because either JAVA_HOME is not defined or not set properly. Once it is done, error would get resolved.
I was also facing same issue but after research of an 1 hour I got a solution.
In system variable set your jdk path in starting.
Variable name: Path
Variable value: C:\ProgramFiles\Java\jdk1.8.0_45\bin;C:\Users\SESA401780\AppData\Local\Android\sdk\build-tools;C:\Users\SESA401780\AppData\Local\Android\sdk\tools;...
Enter Ok Ok ... and
Open new cmd
You are most likely missing the JAVA_HOME environment variable. It looks like the java.exe you are running from the command line is finding your JRE, not your JDK. Set JAVA_HOME to the location of your JDK, and move the bin directory of your JDK to be before the JRE in your PATH and try again, should work.
As the error message says:
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.
0_25\lib\tools.jar
tools.jar is expected to be in C:\Program Files\Java\jre1.8,
but it's not there.
That path looks suspiciously like a JRE path,
not a JDK.
Make sure to set JAVA_HOME to the path of your JDK. Then it should work.
It seems that currently JAVA_HOME is pointing to the path of the JRE,
not the JDK.

Error in setting JAVA_HOME

I have recently downloaded Maven and followed the instructions given on this this page. I already have ant installed on my machine.
Now, if I want to verify that Maven is installed perfectly or not it is giving me error that JAVA_HOME is not set correctly, but same works perfectly fine for ANT.
For Maven I tried :
1. open cmd
2. type mvn -version
3. Error appeared :
C:\Users\Admin>mvn -version
ERROR: JAVA_HOME is set to an invalid directory.
JAVA_HOME = "C:\Program Files\Java\jre7\bin"
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation
For ANT I tried and worked :
1. open cmd
2. type mvn -version
3. Apache Ant(TM) version 1.9.1 compiled on May 15 2013
I went to the directory to check that java.exe is actually there in that directory or not and it was there. I checked the environment variables they set fine. I restarted the system and checked again but same problem. Please let me know what am I missing.
JAVA_HOME should point to jdk directory and not to jre directory. Also JAVA_HOME should point to the home jdk directory and not to jdk/bin directory.
Assuming that you have JDK installed in your program files directory then you need to set the JAVA_HOME like this:
JAVA_HOME="C:\Program Files\Java\jdkxxx"
xxx is the jdk version
Follow this link to learn more about setting JAVA_HOME:
http://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html
Do not include bin in your JAVA_HOME env variable
Follow the instruction in here.
JAVA_HOMEshould be like this
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_07
JAVA_HOME = C:\Program Files\Java\jdk(JDK version number)
Example: C:\Program Files\Java\jdk-10
And then restart you command prompt it works.
Just remember to add quotes into the path if you have a space in your path to java home.
C:\Program Files\java\javaxxx\ doesn't work
but
"C:\Program Files\java\javaxxx\" does.
The JAVA_HOME should point to the JDK home rather than the JRE home if you are going to be compiling stuff, likewise - I would try and install the JDK in a directory that doesn't include a space. Even if this is not your problem now, it can cause problems in the future!
You are pointing your JAVA_HOME to the JRE which is the Java Runtime Environment. The runtime environment doesn't have a java compiler in its bin folder.
You should download the JDK which is the Java Development Kit. Once you've installed that, you can see in your bin folder that there's a file called javac.exe. That's your compiler.
JAVA_HOME should point to jdk directory like in the image with new variable, like below
PATH should point to jdk bin like below
Run the below command in your terminal and restart it.
> set JAVA_HOME="C:\Program Files\Java\jdk-xx.xx"
xx.xx is the java version

JAVA_HOME does not point to the JDK : Unable to start google app engine

I get the following errors when i try to run a sample project in netbeans on google app server. The server doesn't start up. How can i resolve these errors if they exist ? I am using netbeans 7.1
BUILD FAILED
W:\UnderTest\NetbeansCurrent\Guestbook\nbproject\build-impl.xml:550: The following error occurred while executing this line:
W:\UnderTest\NetbeansCurrent\Guestbook\nbproject\build-impl.xml:300: 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\jre7"
Install jdk and set JAVA_HOME in environments variables to path that you jdk was installed. Currently it points to jre.
probable solution will be hear : setting jdk path in netbeans
or , if you setting JAVA_HOME in windows env then use %JAVA_HOME%

Categories