Kinda new posting up questions here so bear with me. I had to install a XP VM recently in order to run a program that required use of an Oracle 10g client. I setup my tomcat server and when I went through the directory and started the .jsp file, I got this error
2011-02-22 09:13:01,291 ERROR (org.apache.jasper.compiler.Compiler:394) - Javac exception
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
Weird thing is I set my JAVA_HOME variable in my VM to 'C:\Program Files\Java\jdk1.6.0_24;' and my PATH variable to '%JAVA_HOME%\bin;'.
It says that its a jasper-complier error... I made sure to add several TOMCAT_HOME variables in my eclipse library path that looked at the jasper-compiler,jasper-runtime,jsp-api.jar, and servlet-api.jar located in my tomcat server folder.
I also followed these instructions here, that state to add the jdk\bin's tools.jar to Eclipse's Ant runtime global entries
Any help appreciated, I'm stumped.
It usually happens because Oracle ships with an outdated version of JDK which conflicts the PATH that we set. Scan your PATH environment variable for any oracle JDK and remove it. It should help.
Look into your Launcher configurations (of type 'Apache Tomcat') and find the one created when you launched the JSP. There must be an 'environment tab'. You could define the JAVA_HOME here. Is this a version 5 of Tomcat (or earlier) ? Starting with version 5.5, Jasper has an embedded JDT (eclipse java compiler).
Hey I figured it out, just made sure you add to your JDK to your PATH variable (ie. java\jdk...\bin) and I also added it to my tomcat\lib folder and added it to my projects library as another variable.
Related
JAVA_HOME does not point to the JDK.(Spring Tool Suite)
I am getting an error while running Spring Tool Suite(3.9.5.RELEASE) as
org.apache.tools.ant.BuildException: 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_181"
As i already set the java path in Environmental Variable-->System variables as
Variable Name : JAVA_HOME and
Variable Value : C:\Program Files\Java\jdk1.8.0_131
and in Environmental Variable-->user variables as
Variable Name : path and
Variable Value : C:\Program Files\Java\jdk1.8.0_131
and in my C:\Program Files\Java\ drive there is jdk1.8.0_131 and jre1.8.0_181.
I set the path properly to JDK, also I restarted the application too, even restarted the Computer too, still I am getting the same error again.
Is there any other solution to avoid such error?
Check your project build path if it is pointing to JRE instead of JDK.
Else Check,
The path for the tools.jar, if it is wrong? or,
Is it pointing to an older version of Java? or,
If tools.jar is missing?
If all the above options do not work try reinstalling JDK.
I installed STS in eclipse Python instead of using separate STS tool and problem got solved..Still wonder why the path shows in STS tool point to jre even after setting to JdK...but i install and run STS in eclipse and it worked properly, wasted my 2 days on this error.
Thanks for your time , learned a lot about settings from you guys
I am getting the following error while using the following command
mvn clean install package
Error
No compiler is provided in this environment. Perhaps you are running
on a JRE rather than a JDK?
I have tried the solutions already present online but none of them worked, I have my JDK path selected in the installed JRE's on my eclipse.
I am using Ubuntu 16.04. Can someone help?
I have already tried the solution given in No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
but that didn't help. I already have my JDK path selected correctly
Check JAVA_HOME path is set as the environment variable pointing to JDK. Refer maven installation steps for more information.
https://maven.apache.org/install.html
Give the jdk path in /etc/environment
Eg : JAVA_HOME="/usr/lib/jvm/java-8-oracle"
then
source /etc/environment
also add in bashrc
vi ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
source ~/.bashrc
I had this same exact error.
There are a lot of possible solutions posted for this problem, even more duplicates. However, after checking many of them I did not find the solution. After some tries and investigations among my environment settings I have found out that the issue was caused by having multiple java paths pointing to different versions that were set up by different IDE's. Also, it seems that Maven was trying to use the first version it found in the PATH settings which actually appeared to be a JRE version.
The solution for me was to put the path pointing to Java JDK as the first path in the PATH environment settings.
Also, make sure that the new environment settings are in effect before you try to use Maven again.
A very simple way to see if mvn actually tries to use the JDK is to execute the following command:
mvn -version
It will print out the Java paths along with other info.
The main problem has to do with the Eclipse.ini settings in your Eclipse startup path such as my file is here: "O:\Dump\XFer\Apps\java\eclipse\mars\eclipse.ini"
The next image is the error I was getting.
The reason has to do with the JDK settings for Eclipse.
You can try and change the Build/Workspace JRE with Eclipse, but it will not fix the problem.
What you have to do is Make sure your Eclipse ini has the correct path for the "JDK" is set in your eclipse startup setting.
i.e "C:/Program Files/Java/jdk1.8.0_74/bin/javaw.exe"
It is probably a good idea to make sure your environment variable(s) for Java_Home are set correctly as well.
I had the same problem. The default java in my path was C:\Windows\System32\java.exe (Java 7 installed as public JRE). I renamed this executable then added Java 8 to the PATH explicitly and problem was solved!
When trying to deploy my application to the Google App Engine server I get the following error:
Cannot get the System Java Compiler. Please use a JDK, not a JRE.
All solutions I've seen for this involve editing an eclipse configuration file, but I'm not using eclipse. I'm executing appcfg.cmd from the dos prompt.
I have a jdk installed and my JAVA_HOME is pointing to it:
c:\program files\java\jdk1.7.0_45
Few points:
Could you check if the JAVA_HOME\bin folder is in the PATH environment variable. If not put that and make sure that it is pointing to the correct version.
Also check java -version on your machine after setting it.
I think you need to add the bin folder as the sub-directory please give it a try
c:\program files\java\jdk1.7.0_45\bin
When i am running Jenkins which checks out code from a repository and perform mvn package or some command. I get this error:
Unable to locate the Javac Compiler in: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../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.
My JAVA_HOME points at jdk location only.Still it looks at
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/tools.jar
for the compiler.Why is that???
It seems the problem is with the code ..It points to /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/ for the tools.jar,whereas it needs to look into the /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/lib/ where the jar is present.I tried copying the jar to jre /lib/ but to no avail.Any solutions for this...
Thanks for d answers anyway..
You need jdk (java development kit) to compile java programs. jre only use to run compiled java programs. in your case its point to a jre and thats why you are getting this.
you can download the jdk and install.
you can download jdk rpm from here
http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html
use this to choose java alternative if you have already installed.
/usr/sbin/alternatives --config java
Uninstall the installed JRE. Keep only one JAVA defined by JAVA_HOME and define your lib and classpath with respect to JAVA_HOME.