100003358693870
100003358693870

Reputation: 43

noclassdeffound error in java, linux

running a java class by shell script:

java -cp $CLASSPATH CG_GpsRequest "dbname","oracle.jdbc.driver.OracleDriver","abc","abc"

while running the script in unix, getting error,

Exception in thread "main" java.lang.NoClassDefFoundError: CG_GpsRequest
Caused by: java.lang.ClassNotFoundException:

CG_GpsRequest is the class file name.

Upvotes: 0

Views: 94

Answers (2)

Rookie007
Rookie007

Reputation: 1219

Okay.. If I understand you correctly..

I think its problem with the Package name specification..

Your calss CG_GpsRequest you must have specified in Packaging way for example

com.xxx.yyy.CG_GpsRequest 

So I think JVM is searching your class com.xxx.yyy.CG_GpsRequest in this patter so Please run your script with the following modifications.

java -cp $CLASSPATH com.xxx.yyy.CG_GpsRequest  "dbname","oracle.jdbc.driver.OracleDriver","abc","abc"

This is just assumption that you have created your class in Pacakgin hirarechy since you havent specified more information.

Upvotes: 1

Arun
Arun

Reputation: 546

Add the folder/path in which your java class exists to your CLASSPATH

Upvotes: 0

Related Questions