0

I am trying to run a java class from a .jar file in unix environment, but i am getting the following error,

Exception in thread "main" java.lang.NoClassDefFoundError: SystemBootstrap
   at gnu.java.lang.MainThread.run(libgcj.so.7rh)
    Caused by: java.lang.ClassNotFoundException: SystemBootstrap not found in gnu.gcj.runtime.SystemClassLoader{urls=[], 
 parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
  at java.net.URLClassLoader.findClass(libgcj.so.7rh)
  at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
  at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
   at gnu.java.lang.MainThread.run(libgcj.so.7rh)

The command i am using to run the class is

 java -cp BatchFramework.jar  SystemBootstrap dnqLtrBatch DEV1

SystemBootstrap is the class to be called , i am not able to solve this.And i am very new to unix.

Mandrek
  • 1,159
  • 6
  • 25
  • 55
  • Only one solution: You have to supply the missing class. Find the JAR that contains the missing class and make it available at runtime. – duffymo Jul 25 '17 at 14:35
  • @duffymo the jar BatchFramework contains the class SystemBootstrap , i have checked – Mandrek Jul 25 '17 at 14:36
  • Then the BatchFramework is not packaged correctly. It's not in the CLASSPATH. The JVM cannot find it at runtime. If this is an executable JAR, I think it means you either don't have a manifest to tell the JAR where to find its dependencies OR the dependent JARs are not packaged into a "fat" executable JAR. – duffymo Jul 25 '17 at 14:41
  • @duffymo ok so the CLASSPATH is correct ? – Mandrek Jul 25 '17 at 14:45
  • obviously not. It doesn't include your BatchFramework JAR with the class that cannot be found. – duffymo Jul 25 '17 at 14:45
  • @duffymo ok so i should rebuild the BatchFramework jar ? – Mandrek Jul 25 '17 at 14:47
  • Rebuild it in a different way. Simply repeating the same behavior that gave you the JAR you have won't change anything. It's easy if you use Maven: https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven – duffymo Jul 25 '17 at 14:48

0 Answers0