Running J2EE Eclipse in a VM - Unable to find a javac compiler

点点圈 提交于 2019-12-11 00:27:27

问题


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.


回答1:


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.




回答2:


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).




回答3:


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.



来源:https://stackoverflow.com/questions/5079523/running-j2ee-eclipse-in-a-vm-unable-to-find-a-javac-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!