I am building aprofplot on Ubuntu using Apache Ant. When I enter the command ant in the folder containing build.xml, I get this error:
BUILD FAILED
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:923: The following error occurred while executing this line:
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:263: 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-amd64/jre"
Total time: 2 seconds
ashwin#ashwin-VirtualBox:~/aprof/aprofplot$ javac --version
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
I have openjdk installed too. What am I doing wrong? Do I have to install further packages?
It seems, you have wrong JAVA_HOME variable. It points to JRE, from your output:
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"
Not JDK. That is why, Ant can't locate the javac and fails. You have to modify it. Try to delete jre at the end, seems, javac should be under /usr/lib/jvm/java-7-openjdk-amd64/bin. So you have to set it to/usr/lib/jvm/java-7-openjdk-amd64
Related
After upgrading my macOS to Big Sur, I have not been able to run my grails application. I keep getting this error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':server:compileGroovy'.
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
I have reinstalled java, but still getting the same error.
Use this command to see java paths: /usr/libexec/java_home -V | grep jdk
Copying tools.jar in /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/ to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/ solved the problem.
I want to Install Java 11 or 12 on my Ubuntu 14 machine. As of now, I'm isntalling 12.
To Install, I've downloaded Java at below location and extracted too at same location.
/usr/lib/jvm
/usr/lib/jvm/jdk-12.0.1
After that, I've added JAVA_HOME path in environment file
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/jdk-12.0.1/"
export JAVA_HOME
But when I check java -version, It shows me below error
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: sudo apt-get install <selected package
May I know please, What am doing wrong....?
Thanks
As correctly pointed out in the comments by RealSkeptic, the JAVA_HOME environment variable is not utilized by your shell to detect where the java runtime is located.
Try adding the following to the line to your environment file after export JAVA_HOME
export PATH=${JAVA_HOME}/bin:${PATH}
If your JAVA_HOME is set correctly it should be added correctly to your PATH
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.
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
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