I have created a small project which has the below folder structure.
in source folder i have created structure like com/myorg/myapp/service, com/myorg/myapp/util, com/myorg/myapp/database folders.
in side util/database folders i have java classes that i use in my service class.
I have package statement in all my util classes as package com.myorg.myapp.util;
in side service class i have my service class which has package statment com.myorg.myapp.service;
in side database classes i have my service class which has package statment com.myorg.myapp.database;
After compiling java code from jdeveloper , i can run my service class which is producing desired results. I can run my service class from command promt also and it works fine. For this i have written a bat file which is as below.
Now i want to move this code to linux machine and run. i prepared shell script to run MyService class just the same as i have created dos bat file.
But i am not able to run. I am getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.myorg.myapp.service.MyService
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib64/libgcj.so.5.0.0)
at gnu.gcj.runtime.FirstThread.run() (/usr/lib64/libgcj.so.5.0.0)
at _Jv_ThreadRun(java.lang.Thread) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib64/libgcj.so.5.0.0)
at __gcj_personality_v0 (/opt/oracle/NewCode/MyApp/java.version=1.4.2)
at __libc_start_main (/lib64/tls/libc-2.3.4.so)
at _Jv_RegisterClasses (/opt/oracle/NewCode/MyApp/java.version=1.4.2)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in
murali dhary wrote:I am not using StringBuilder in my code.
But maybe some code in one of the libraries that you are using, is using StringBuilder. Maybe one of those libraries requires Java 5 or newer, so it won't work on Java 1.4.
Which operating system and which version of Java are you using? Looking at the error messages, it looks like you're using a 64-bit version of Linux with GNU Java (gcj). Note that GNU Java is not a very good version of Java - it's an incomplete, not fully compatible and very slow implementation of Java 1.4.
I suggest you install a newer version of Sun Java, instead of using the default GNU version of Java that came with your operating system.