ClassNotFoundException: en gnu.gcj.runtime.SystemClassLoader

I am getting this Exception when i tried to run a java Application with the help of a Script

Caused by: java.lang.ClassNotFoundException: com.tata.topListQuoteSamples.TOPLISTSample not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/home/sai/NewgdpapiToplist1/lib/commons-logging-1.0.4.jar,file:/home/sai/NewgdpapiToplist1/lib/log4j-1.2.8.jar,file:/home/sai/NewgdpapiToplist1/lib/mail.jar,file:/home/sai/NewgdpapiToplist1/lib/marketdata-b1.1.jar,file:/home/sai/NewgdpapiToplist1/lib/middleware.jar,file:/home/sai/NewgdpapiToplist1/lib/gdpapi-all.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.lang.ClassLoader.loadClass(
   at java.lang.ClassLoader.loadClass(
End time:  Fri Mar 9 09:15:55 EST 2012

preguntado el 09 de marzo de 12 a las 14:03

Are you sure you need to use GCJ? -

I dont know what is meant by GCJ , could you please elobrate -

You are using GCJ as your java (the hint in the error message AFAIK this hasn't been well support for a number of years. I would use the Sun/Oracle/OpenJDK instead. Try running java --version -

GCJ is a slow, incomplete, old, not fully compatible open source implementation of Java. You do not want to use this, certainly not for a production system. Install Oracle's Java implementation and use that instead. -

@Jesper - Do you think Eclipse ecj compiler would work? -

1 Respuestas

Basically you need to set the class path straight inside your script.

if you're executing java with "java.exe" (or whatever the linux equivalent) make sure you specify the class path (or if you're running that from the command line, make sure you either do that or are in the right folder)

respondido 09 mar '12, 14:03

I am setting the path this way in script export JAVA_HOME=/usr/lib/jvm/jre-1.4.2/ export PATH=/usr/lib/jvm/jre-1.4.2/bin - Pawan

what i mean by class path is to have all the classes you use available to the script that executes your main class. That means it must know the path to the environment (maybe your script doesn't even take into account the JAVA_HOME variables) and ALSO to know the path to your actual classes.... all of them. as such java -cp PathToClasses;PathToSomeMoreClasses;Etc; would be the way to do it. Show me your package structure and your script, and i could probably tell you exactly how to modify your script so that it runs. - Vlad-Ardelean

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.