Skip to Content
author's profile photo Former Member
Former Member

NoClassDefFoundError when not in Eclipse

I developed a standalone app in eclipse, and it works fine. I created the .jar file, and set it up for distribution, but when i execute it outside of Eclipse, i get a NoClassDefFound error on JCO$Record.

I can see the class in the sapjco.jar file, and i have this file on my classpath. i also have my JCO install folder in my path, so windows can find the .dlls.

I am not sure what is wrong. I check my classpath and path immediately after the exception, and they look fine. i am specifying the classpath with a set statement, and not the -cp extension, if that makes a difference.

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2004 at 09:10 PM

    Hi David,

    what do you mean with set statement, setting an environment variable? You can of course set an env. variable for classpath(s), but you still have to use the -cp %YOURENV% option to tell the JVM about that.

    Hope that helps.

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 08, 2004 at 04:38 PM

    actually, i already do what you suggest. here is my .bat file (please disregard strange newlines in SETs):

    @echo off

    set OCP=%CLASSPATH%

    set OP=%PATH%

    set CLASSPATH=c:\JCO\sapjco.jar

    set CLASSPATH=%CLASSPATH%;c:\xerces-1_4_4\xerces.jar

    set CLASSPATH=%CLASSPATH%;c:\java\MSJDBC\lib\mssqlserver.jar

    set CLASSPATH=%CLASSPATH%;c:\com\siemens\SMMSAPInterface.jar

    set CLASSPATH=%CLASSPATH%;c:\java\j2sdk1.4.2\jre\lib\rt.jar;

    set PATH=%PATH%;c:\jco\;

    java -verbose:class -cp %CLASSPATH% -jar c:\com\siemens\SMMSAPInterface.jar

    set CLASSPATH=%OCP%

    set PATH=%OP%

    the CLASSPATH% variable and PATH variable are correct when i look at them (before the final 2 sets), but jvm sill cannot fin sapjco.jar in c:\jco

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I still do not know what is going on, becuase i don't understand the whole .jar thing i guess, but...

      I changed from .jarring my classes to just creating the appropriate directory structure. this is only MY classes, not sapjco.jar

      now it seems to work. i dont know why when MY classes are .jarred, they cannot find sapjco, and when they are not .jarred, and are using the same classpath on the java command line, they find sapjco.jar just fine.

      anyways, thanks for the suggestions. i will just run my classes un.jarred