Use library in additional JAR-File

Hello,

I created a java project with eclipse. Within this project I use an additional library. I added it via Build Path > Configure Build Path > Libraries > Add External JARs.

When I start the project from within eclipse, everthing works fine. But now I want to start the application as standalone from the terminal. So I copied all class-File from ~/workspace/project/bin and the JAR-File of the external library "extlib.jar" in one Folder.

Now I change to that directory and start the programm with "java classname". But when the functionality of the external lib is used the first time, I get a "java.lang.NoClassDefFoundError".

How do I tell the java-Interpreter to use the extlib.jar? I already tried "java -cp .:extlib.jar classname" but that did not work. What am i doing wrong?

[828 byte] By [schneidexea] at [2007-11-26 22:04:02]
# 1
You need to specify the classpath as an absolute path. The use of a relative path is fraught with problems if you don't know what you're doing :)
ChuckBinga at 2007-7-10 10:46:56 > top of Java-index,Desktop,Deploying...
# 2
Ah, ok.... good to know. Thank you for this hint. It works now perfectly with:java -cp $(pwd):$(pwd)/extlib.jar classnameGreetzschneidexe
schneidexea at 2007-7-10 10:46:56 > top of Java-index,Desktop,Deploying...