[英]Add URL to classpath via command line
I'm trying to achieve the equivalent to this: 我正在尝试达到以下效果:
java.exe -cp "C:\my_test\my_jar.jar;C:\my_test\lib\*;" com.test.Main
but using an URL like this: 但是使用这样的URL:
java.exe -cp "http:\\192.168.1.12\my_test\my_jar.jar;http:\\192.168.1.12\my_test\lib\*;" com.test.Main
The error is: Could not find or load main class
, but if I look into http:\\\\192.168.1.12\\my_test\\my_jar.jar
I can see my Main class there. 错误是:
Could not find or load main class
,但是如果我查看http:\\\\192.168.1.12\\my_test\\my_jar.jar
我可以在那看到我的主类。 Is there any way I can do this via command line ? 有什么办法可以通过命令行执行此操作?
PS: I can reach http:\\\\192.168.1.12\\my_test\\my_jar.jar
via browser PS:我可以通过浏览器访问
http:\\\\192.168.1.12\\my_test\\my_jar.jar
The classpath is composed of jar files and directories. 类路径由jar文件和目录组成。 Not of http URLs.
不属于http URL。 You'll have to programmatically create a UrlClassLoader to load classes from a server that way.
您必须以编程方式创建UrlClassLoader才能以这种方式从服务器加载类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.