第一个jetty程序
- 下载
- 新建root目录
解压之后在webapps下新建root目录
- 新建index.jsp文件
在root目录中新建index.jsp文件
<html> <body> <% out.println("hello world") %> </body> </html>
- 启动
进入控制台运行
java -jar start.jar
在windows下可能出现下面错误,原因是执行java命令时优先使用windows自带的java,但是lib却使用我们配置的classpath.
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:119) at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:208) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453) ....
解决办法
C:\Program" "Files\Java\jdk1.7.0_60\bin\java -jar start.jar
- 访问
http://localhost:8080 即可看到hello word
2023年9月12日 19:45
Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though.
2024年1月08日 05:57
Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet!