0

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:

 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. Is there any way I can do this via command line?

P.S: I can reach http:\\192.168.1.12\my_test\my_jar.jar via browser

4
  • The slashes are the other way. It's http://, not http:\\. Commented Jul 22, 2015 at 15:01
  • Already tried that but it keeps saying Could not find or load main class. But if I try to access http:\\192.168.1.12\my_test\my_jar.jar I can see my Main class there Commented Jul 22, 2015 at 16:39
  • The classpath is composed of jar files and directories. Not of http URLs. You'll have to programmatically create a UrlClassLoader to load classes from a server that way. Commented Jul 22, 2015 at 16:48
  • Make it an answer so I can mark as correct @JBNizet Commented Jul 22, 2015 at 18:32

1 Answer 1

1

The classpath is composed of jar files and directories. Not of http URLs. You'll have to programmatically create a UrlClassLoader to load classes from a server that way.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.