web maven jetty Unable to find a javac compiler
来源:互联网 发布:mac上用什么输入法 编辑:程序博客网 时间:2024/06/05 03:19
maven工程用jetty启动的通过代码启动
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
public class Sample {
public static void main(String[] args) throws Exception {
Server service = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8082);
connector.setHost("localhost");
service.setConnectors(new Connector[] { connector });
WebAppContext context = new WebAppContext("src/main/webapp", "/webmavenjetty");
service.addHandler(context);
service.setStopAtShutdown(true);
service.setSendServerVersion(true);
service.start();
service.join();
}
}
run as -> java application之后正常
通过浏览器访问时如下错:
ERROR: 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
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
at org.apache.jasper.compiler.AntJavaCompiler$JavacObj.run(AntJavaCompiler.java:355)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
其实就是tools.jar这个jar文件没找到先查看JDK的安装目录下是否有tool.jar文件(Java\jdk1.7.0_45\lib)再把tool.jar加到jre中,如下:Eclipse window -> Preferences ->Java ->Installed JRES -> Edit ->Add External JARS 添加tool.jar
- web maven jetty Unable to find a javac compiler
- Unable to find a javac compiler
- Unable to find a javac compiler
- Unable to find a javac compiler
- Unable to find a javac compiler,
- Unable to find a javac compiler---JBOSS
- Unable to find a javac compiler错误之解决办法
- Jsp运行时报错:“Unable to find a javac compiler ”
- eclipse ant 的时候 Unable to find a javac compiler
- java 调 ant 出现 Unable to find a javac compiler
- build.xml:278: Unable to find a javac compiler;
- build.xml:278: Unable to find a javac compiler;
- maven项目在运行jetty时:Unable to locate the Javac Compiler
- Maven Unable to locate the Javac Compiler
- Unable to find a javac compiler;Perhaps JAVA_HOME does not point to the JDK
- Unable to find a javac compiler;Perhaps JAVA_HOME does not point to the JDK解决
- Ant Unable to find a javac compiler Perhaps JAVA_HOME does not point to the JDK 解决办法
- 环境变量设置无误,但Tomcat仍报“Unable to find a javac compiler”错误的排除
- 搜索引擎到人工智能的终极演进
- shell脚本里读取命令行参数
- Android中的系统广播集合
- TQFP 和LQFP 器件的焊接方法
- uva 10167 - Birthday Cake
- web maven jetty Unable to find a javac compiler
- Ubuntu “无法获得锁”解决方案(E: 无法获得锁 /var/cache/apt/archives/lock – open (11 资源临时不可用)
- 关于UIWebView的一些应用,包括与JS交互,前进,后退等
- 极限编程的集成测试工具-Dunit
- Count The Carries
- DevExpress 行事历(Scheduler)的常用属性、事件和方法
- FFMpeg分析1:URLProtocol,URLContext和ByteIOContext
- Android应用插件化开发
- Linux中文显示乱码设置