当前位置: 技术问答>linux和unix
关于linux java
来源: 互联网 发布时间:2016-09-09
本文导语: 本人在虚拟机装的redhat as5 然后装jdk-1_5_0_22-linux-i586-rpm.bin 编译java程序正常 但是我用调用C的库 javac libhb.java 正常 javah libhb 异常 error: cannot access libhb bad class file: ./libhb.class class file conta...
本人在虚拟机装的redhat as5
然后装jdk-1_5_0_22-linux-i586-rpm.bin
编译java程序正常
但是我用调用C的库
javac libhb.java 正常
javah libhb 异常
error: cannot access libhb
bad class file: ./libhb.class
class file contains wrong class: com.zotn.hbc.libhb
Please remove or make sure it appears in the correct subdirectory of the classpath.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:169)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.(RootDocImpl.java:77)
at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:156)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
echo $PATH
/usr/java/jdk1.5.0_22/bin:/usr/java/jdk1.5.0_22/bin:/usr/java/jdk1.5.0_22/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
echo $JAVA_HOME
/usr/java/jdk1.5.0_22
echo $CLASS_PATH
.:/usr/java/jdk1.5.0_22/lib/dt.jar:/usr/java/jdk1.5.0_22/lib/tools.jar:/lib
请大侠帮忙 先谢谢了!!!!
然后装jdk-1_5_0_22-linux-i586-rpm.bin
编译java程序正常
但是我用调用C的库
javac libhb.java 正常
javah libhb 异常
error: cannot access libhb
bad class file: ./libhb.class
class file contains wrong class: com.zotn.hbc.libhb
Please remove or make sure it appears in the correct subdirectory of the classpath.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:169)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.(RootDocImpl.java:77)
at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:156)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
echo $PATH
/usr/java/jdk1.5.0_22/bin:/usr/java/jdk1.5.0_22/bin:/usr/java/jdk1.5.0_22/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
echo $JAVA_HOME
/usr/java/jdk1.5.0_22
echo $CLASS_PATH
.:/usr/java/jdk1.5.0_22/lib/dt.jar:/usr/java/jdk1.5.0_22/lib/tools.jar:/lib
请大侠帮忙 先谢谢了!!!!
|
因为你的类名不是libhb,
javah com.zotn.hbc.libhb 看看
或者在libhb.java里把
package com.zotn.hbc 去了
javah com.zotn.hbc.libhb 看看
或者在libhb.java里把
package com.zotn.hbc 去了