0

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 :)

Mohd
  • 191
  • 3
  • 14
  • 2
    [This might be a good start](http://stackoverflow.com/questions/19917960/launch4j-how-to-attach-dependent-jars-to-generated-exe) – MadProgrammer Jan 31 '17 at 07:09

1 Answers1

0

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
Tobias Otto
  • 1,634
  • 13
  • 20
  • the MainClass.class file in this path : /home/momy/A1/specter/bin/specterMain/MainClass.class ....... so I did this ; java -cp /home/momy/A1/specter bin.specterMain.MainClass .....got same error that class not found !!! – Mohd Feb 03 '17 at 15:10
  • The "bin" is a directory and not a package! Put it in the classpath. – Tobias Otto Feb 03 '17 at 18:22
  • Could you please accept my answer, so that i receive the points? – Tobias Otto Feb 04 '17 at 08:59