Packaging the Client App in a Jar

Discussions

EJB programming & troubleshooting: Packaging the Client App in a Jar

  1. Packaging the Client App in a Jar (4 messages)

    Hi everyone,

    I just packed all my classes in a nice jar and designated the class with main using Main-Class. Now the problem starts:

    java -jar -classpath %A_BUNCH_OF_CLASSPATH% app.jar

    Guess what, java cannot find the classes on the -classpath? Does java look at the -classpath at all when executing an application within a .jar file?

    Thanks for all your help!
  2. Are you sure that the directory that the jar file is in (possibly the current directory) is in the classpath?
    eg
    java -jar -classpath %A_BUNCH_OF_CLASSPATH%;. app.jar
    (nb ------ )
  3. It executes my app in the app.jar, but my app cannot find the JDBC driver which is specified in the -classpath argument.

    Yeah, I do have the "." in the -classpath.

  4. If I run my app using the same classpath settings but with the classes in a directory structure instead of packaged in a .jar file, everything works great.

    If one wants to run from a .jar file, does all extra class libraries need to be in the .jar file as well?
  5. Yoy seem to have a space in your -classpath parm