简体   繁体   English

Java,Linux中的noclassdeffound错误

[英]noclassdeffound error in java, linux

running a java class by shell script: 通过shell脚本运行Java类:

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

while running the script in unix, getting error, 在Unix中运行脚本时出现错误,

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

CG_GpsRequest is the class file name. CG_GpsRequest是类文件名。

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 CG_GpsRequest您必须以打包方式指定的CG_GpsRequest

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. 因此,我认为JVM正在此模式中搜索类com.xxx.yyy.CG_GpsRequest ,因此请使用以下修改来运行脚本。

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. 这只是假设您已经在Pacakgin hirarechy中创建了您的课程,因为您没有指定更多信息。

将Java类所在的文件夹/路径添加到CLASSPATH中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM