Bond Chan [
https://community.jboss.org/people/bondchan921] created the discussion
"dependent class can't be found when invoke by java -classpath xxx -jar jarfile,
but can be found by java -classpath xx class"
To view the discussion, visit:
https://community.jboss.org/message/743272#743272
--------------------------------------------------------------
c1, java -cp LRS3rdPartyClient.jar -jar tasks.jar
c2, java -classpath LRS3rdPartyClient.jar;tasks.jar
com.lombardrisk.build.WaitForServerStart
c1 can't be executed due to an class(org.jnp.interfaces.NamingContextFactory)
can't be found which reside in LRS3rdPartyClient.jar, whereas the c2 can execute
quite confused,
exception thrown by c1:
Exception in thread "main" javax.naming.NoInitialContextException: Cannot
instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.lombardrisk.build.WaitForServerStart.main(WaitForServerStart.java:29)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
... 5 more
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/743272#743272]
Start a new discussion in JNDI and Naming at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]