[英]server doesn't work when I run it in jar
I've got simple class which runs some Main
class from some .jar
file. 我有一个简单的类,它可以从一些.jar
文件运行一些Main
类。
public class Test {
public static void main(String[] args) {
org.runner.Main.main(args);
}
}
But when I run via Eclipse or other IDE - it works fine. 但是,当我通过Eclipse或其他IDE运行时,它可以正常工作。 And in IDE console it shows 并且在IDE控制台中显示
C:\Users\Admin\Desktop\xultestapplication\Test\bin\myapp
C:\Users\Admin\Desktop\xultestapplication\Test\bin\myapp\defaults
C:\Users\Admin\Desktop\xultestapplication\Test\bin\myapp\chrome
C:\Users\Admin\Desktop\xultestapplication\Test\bin\myapp\chrome\content
C:\Users\Admin\Desktop\xultestapplication\Test\bin\myapp\defaults\preferences
server started!
org.runner.Calculator.calculator:org.runner.Calculator|calculator
Sent with code 200
where sent with code 200
means that it successfully sent response to client. 其中sent with code 200
表示它已成功将响应发送给客户端。 But when I run it in cmd java -jar test.jar
- it doesn't work and 但是当我在cmd java -jar test.jar
运行它时-它不起作用并且
H:\disk\EXE>java -jar test.jar
H:\disk\EXE\bin\myapp
H:\disk\EXE\bin\myapp\defaults
H:\disk\EXE\bin\myapp\chrome
H:\disk\EXE\bin\myapp\chrome\content
H:\disk\EXE\bin\myapp\defaults\preferences
server started!
Sent with code 404
the result code is 404. 结果代码为404。
What is the problem? 问题是什么?
Perhaps the server is automatically run from within your Eclipse environment? 也许服务器是在您的Eclipse环境中自动运行的? If this is the case, you must of course make sure it is also run when starting your test outside Eclipse. 如果是这种情况,那么您当然必须确保在Eclipse外部启动测试时它也可以运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.