Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, when i run this .sh-script: Code: #!/bin/bash java -Xmx256M -classpath sapConnector.jar:lib/GenericConnector.jar:lib/SAPmdi.jar com.itellium.dwh.osg.sap.impl.OSGSapConnectorImpl I get the following Exception: Code: Exception in thread "main" java.lang.NoClassDefFoundError: com.itellium.dwh.osg.sap.impl.OSGSapConnectorImpl at gnu.java.lang.MainThread.run(libgcj.so.81) Caused by: java.lang.ClassNotFoundException: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    3

    Exception when running a java application through a shell-script


    Hello,

    when i run this .sh-script:
    Code:
    #!/bin/bash
    java -Xmx256M -classpath sapConnector.jar:lib/GenericConnector.jar:lib/SAPmdi.jar com.itellium.dwh.osg.sap.impl.OSGSapConnectorImpl
    I get the following Exception:

    Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: com.itellium.dwh.osg.sap.impl.OSGSapConnectorImpl
       at gnu.java.lang.MainThread.run(libgcj.so.81)
    Caused by: java.lang.ClassNotFoundException: com.itellium.dwh.osg.sap.impl.OSGSapConnectorImpl not found in gnu.gcj.runtime.SystemClassLoader{urls=[], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
       at java.net.URLClassLoader.findClass(libgcj.so.81)
       at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.81)
       at java.lang.ClassLoader.loadClass(libgcj.so.81)
       at java.lang.ClassLoader.loadClass(libgcj.so.81)
       at gnu.java.lang.MainThread.run(libgcj.so.81)
    The classpath should be ok, because i have a similar shell-script running on a windows-machine (.bat).

    I am not good with linux-systems, so is there some syntax error in the script?

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    I don't mean to bash gcj, but I have never had good luck having java code run with it properly. I would suggest trying a different JDK, you could use sun jdk or openjdk. Also, I have better luck setting the CLASSPATH environment variable with the jars being used.

  3. #3
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    It is a classpath problem. If you compiled this code using the Sun JDK and are executing it w/ the GNU JRE, that's probably your problem. Either run it using the Sun JRE or re-compile using gcj.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •