简体   繁体   English

类路径和德比罐

[英]classpath & Derby jars

With Linux ; 使用Linux; Application Directory is : 应用程序目录为:

/home/momy/A1/specter/ / home / momy / A1 / specter /

|
- - → src/
      |
      - - → specterMain/
        |
        - - → MainClass.java
- - → lib/
      |
      - - → derby.jar
      - - → derbyclient.jar     

i) to add all derby jar files to classpath : i)将所有derby jar文件添加到classpath:

java -classpath /home/momy/A1/specter/lib/* src.specterMain.MainClass java -classpath / home / momy / A1 / specter / lib / * src.specterMain.MainClass

I get this : Error: Could not find or load main class .home.momy.A1.specter.lib.derbyclient.jar 我得到这个:错误:找不到或加载主类.home.momy.A1.specter.lib.derbyclient.jar

ii) to set the classpath ii)设置类路径

java -classpath /home/momy/A1/specter src.specterMain.MainClass java -classpath / home / momy / A1 / specter src.specterMain.MainClass

I get this error : Error: Could not find or load main class src.specterSafeMain.MainClass 我收到此错误:错误:无法找到或加载主类src.specterSafeMain.MainClass

on netbeans the application works fine…. 在netbeans上,该应用程序运行良好……。 I repackage the application to .exe version,the .exe start works but DB not work shows that the derby jars should be included in classpath . 我将应用程序重新打包为.exe版本,.exe启动有效,但DB无效,表明应该在类路径中包含derby jar。
Any ideas :) 有任何想法吗 :)

You have to add the path to the classes, but not to the sources. 您必须将路径添加到类,而不是源。

Where does Netbeans produce the files with fileending *.class ? Netbeans在哪里生成文件尾为* .class的文件? Add this directory to the classpath: 将此目录添加到类路径:

java -cp bin:lib/derby.jar:lib/derbyclient.jar specterMain.MainClass

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

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