NoClassDefFoundError only running jar

Ppl,

I'm not sure if that's the right place to post this question...sorry if it isn't.

I'm getting crazy with this problem.

I'm trying to compile this simple line of code

DriverManager.registerDriver(new org.postgresql.Driver());

It compiles well in Eclipse but, after exporting to jar, I can't run it in the command line with

java -jar myJarFile.jar

it throws the following exception

Exception in thread"main" java.lang.NoClassDefFoundError: org/postgresql/Driver

at teste.main(teste.java:16)

I have the postgresql-8.2-504.jdbc3.jar file in the same directory of my jar file.

What the hell is the problem?

Thanks in advance!

Filipe

[782 byte] By [filipea] at [2007-11-27 2:28:36]
# 1
Hi again!The same happens when try to that the following code lineClass.forName("org.postgres.sql",true,ClassLoader.getSystemClassLoader());and also only when running jar the file.Filipe
filipea at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
The system classpath is ignored when running a JAR file. Only the manifest of the JAR file has any significance.
dcmintera at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

I only happens when my app has external Jar's that means without external jar's the app doesn't trigger any exception.

I also tryed to unjar the postgresql-8.2-504.jdbc3.jar file and put it in my project folder but it still doesn't work.

Please, someone shed me light.

Filipe

filipea at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Sir,In you manifest.mf file, add this :Class-Path: postgresql-8.2-504.jdbc3.jar and give it a try,Hope That Helps
java_2006a at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
Hei! So much time wasted trying to fix that problem....Thank you very much, really! :)Greetings,Filipe Paiva
filipea at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6
You are welcome.If you need more than a jar file, so add it after a simple white space like the following :Class-Path: activation.jar axis.jar bsf.jar castor-0.9.5.2.jar commons-codec-1.2.jar
java_2006a at 2007-7-12 2:40:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...