adding external jar into application client

Hi,

I'm developing an application in which both my EJB's and my application client make use of some general classes. To avoid duplication, I thought it was a good idea to create a Java Class Library project (myLibrary) in NetBeans and let the two other projects (ejb and app-client) access them by defining myLibrary in the respective project properties.

This works nicely when I deploy and run my application client from within NetBeans, but since myLibrary is not part of the applications clients jar, it doesn't work using appclient on the console. With good reason, I get a NoClassDefFoundError.

So my question is how can I make sure that my classes are found? Adding them to my classpath didn't seem to do the trick. I suppose I have to include the classes of MyLibrary into the jar of my application client, but have no real idea how to do this...

Thanks,

Vaak

[907 byte] By [vAaka] at [2007-11-27 10:43:03]
# 1

You must include all external Jars (or .class files) in the classpath of your app.

When you run your app "java -cp ......... myapp.main" in the -cp flag put all dependencies of your application.

restevesa at 2007-7-28 19:22:22 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

thanks for the reply!

But I have some doubts on this...

- is it not better to use appclient to start my application since it provides more support regarding provisions of the container?

- I just succeeded executing my app client from the console using appclient and specifying a classpath to myLibrary.jar in the app client's manifest file. This however requires the additional (manual) action of placing this jar-jile in the specified directory, which imo will be easy to forget.

Is there no way of including my library in the jar of the application client?

I'm kind of new to java ee, so if I'm trying to do something stupid here, feel welcome to let me know!

Cheers,

Vaak

vAaka at 2007-7-28 19:22:22 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...