Search code examples
javajarderbylaunch4j

classpath & Derby jars


With Linux ; Application Directory is :

/home/momy/A1/specter/

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

i) to add all derby jar files to classpath :

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

ii) to set the classpath

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

I get this error : Error: Could not find or load main class src.specterSafeMain.MainClass

on netbeans the application works fine…. 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 .
Any ideas :)


Solution

  • You have to add the path to the classes, but not to the sources.

    Where does Netbeans produce the files with fileending *.class ? Add this directory to the classpath:

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