Hi friends,
I have build swing based application on windows os and I want to run this application in linux.
The .jar file runs perfectly on windows. but not running on linux.
gives error as below. pls. help


regent@regent:~/main the law$ java -jar thelaw.jar
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.regent.thelaw.mainGUI.HomePageFrame
at ._ZN4java4lang11VMThrowable16fillInStackTraceEPNS0_9ThrowableE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9Throwable16fillInStackTraceEv (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9ThrowableC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang5ErrorC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang12LinkageErrorC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang20NoClassDefFoundErrorC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang13VMClassLoader18transformExceptionEPNS0_5ClassEPNS0_9ThrowableE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang13VMClassLoader12resolveClassEPNS0_5ClassE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang5Class15initializeClassEv (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang5Class7forNameEPNS0_6StringEbPNS0_11ClassLoaderE (/usr/lib/libgcj.so.6.0.0)
at ._ZN3gnu4java4lang10MainThread3runEv (/usr/lib/libgcj.so.6.0.0)
at ._Z13_Jv_ThreadRunPN4java4lang6ThreadE (/usr/lib/libgcj.so.6.0.0)
at ._Z11_Jv_RunMainP14_Jv_VMInitArgsPN4java4lang5ClassEPKciPS6_b (/usr/lib/libgcj.so.6.0.0)
at .main (/usr/lib/libgij.so.6.0.0)
at .__libc_start_main (/lib/tls/i686/cmov/libc-2.3.5.so)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:thelaw.jar,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at ._ZN4java4lang11VMThrowable16fillInStackTraceEPNS0_9ThrowableE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9Throwable16fillInStackTraceEv (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9ThrowableC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9ThrowableC1EPNS0_6StringEPS1_ (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang9ExceptionC1EPNS0_6StringEPNS0_9ThrowableE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang22ClassNotFoundExceptionC1EPNS0_6StringEPNS0_9ThrowableE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang22ClassNotFoundExceptionC1EPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java3net14URLClassLoader9findClassEPNS_4lang6StringE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang11ClassLoader9loadClassEPNS0_6StringEb (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang11ClassLoader9loadClassEPNS0_6StringE (/usr/lib/libgcj.so.6.0.0)
at ._Z13_Jv_FindClassP13_Jv_Utf8ConstPN4java4lang11ClassLoaderE (/usr/lib/libgcj.so.6.0.0)
at ._ZN4java4lang5Class7forNameEPNS0_6StringEbPNS0_11ClassLoaderE (/usr/lib/libgcj.so.6.0.0)
at ._ZN20_Jv_BytecodeVerifier21verify_instructions_0Ev (/usr/lib/libgcj.so.6.0.0)
at ._Z16_Jv_VerifyMethodP16_Jv_InterpMethod (/usr/lib/libgcj.so.6.0.0)
at ._ZN21_Jv_InterpreterEngine9do_verifyEPN4java4lang5ClassE (/usr/lib/libgcj.so.6.0.0)
at ._ZN10_Jv_Linker12verify_classEPN4java4lang5ClassE (/usr/lib/libgcj.so.6.0.0)
at ._ZN10_Jv_Linker14wait_for_stateEPN4java4lang5ClassEi (/usr/lib/libgcj.so.6.0.0)
...8 more

This is happening cause you are using GCJ which does not support all classes mentioned in the official J2SE specifications.
Most probably on Windows you are using the JRE from Sun, I suggest you install the same on your Linux machine.

That's his worst problem, but not the immediate one.
The immediate one is failing to take into consideration the requirement to add the application classes to the classpath he uses to attempt to run it.

Since you are running Ubuntu you can install the Sun JRE directly by issuing:

apt-get install sun-java6-jre

in your terminal.

But if you plan on doing some Java developement you should install the java SDK instead,
to do so just issue the following command in your terminal

apt-get install sun-java6-jdk

But first I suggest you check whether all the required Jars/classes are included in your classpath as jwenting mentioned

thanks but when I give command

apt-get install sun-java6-jdk

it gives me error like

root@regent:~/Desktop# apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree... Done
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Couldn't find package sun-java6-jdk

so i give command

apt-get update

that gives me error

root@regent:~/Desktop# apt-get update
Ign cdrom://Ubuntu 5.10 _Breezy Badger_ - Release i386 (20051012) breezy Release.gpg
Ign http://archive.ubuntu.com breezy Release.gpg
Ign http://archive.ubuntu.com breezy Release
Ign http://archive.ubuntu.com breezy/universe Packages
Ign http://archive.ubuntu.com breezy/universe Packages
Ign http://archive.ubuntu.com breezy/universe Packages
Ign http://archive.ubuntu.com breezy/universe Packages
Ign http://archive.ubuntu.com breezy/multiverse Packages
Ign http://archive.ubuntu.com breezy/multiverse Packages
Err http://archive.ubuntu.com breezy/universe Packages
404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com breezy/universe Packages
404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com breezy/universe Packages
404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com breezy/universe Packages
404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com breezy/multiverse Packages
404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com breezy/multiverse Packages
404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/universe/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/universe/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/universe/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/universe/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/multiverse/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/breezy/multiverse/binary-i386/Packages.gz 404 Not Found [IP: 91.189.88.31 80]
Reading package lists... Done
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Some index files failed to download, they have been ignored, or old ones used instead.

what should be the problem????

Thats cause your Ubuntu version is too old and the repositories are no longer supported, U will need to upgrade to a more recent version (@least 6.04) use for installing software via apt,

or do a manual install by downloading jdk from here

is it possible to upgrade version using command

apt-get upgrade

because it also gives me error....
most prob. same as apt-get update

root@regent:~/Desktop# apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://archive.ubuntu.com breezy/multiverse Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_breezy_multiverse_binary-i386_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems

it tells me to update the system..

and before that I tried for mannual installation but. It also gives me so much error...

I know there are total 3 types of installation
.deb
.rpm
.tar.gz

also try all but not succedd..

I tried for all three but not succedd cause I also want install MySql. and Jdk as u know.

.rpm works only on Red Hat Based systems, Ubuntu is based on Debian so it uses to .deb versions.

For you currently it is no longer possible to upgrade to a newer version of Ubuntu by directly invoking

apt-get upgrade

cause your version is too old.
In case you need to use MySQL also, I suggest you download the latest version from the Ubunu site

Cause otherwise u would need to manually compile and install all the software you need.

currently to upgrade my breezy version to dapper i am doing this steps...

edit the file /etc/apt/sources.list (as root)
replace all instances of "breezy" with "dapper"

run the command
"sudo apt-get update && sudo apt-get dist-upgrade"

can I work after it...?????

I wouldn't recommend upgrading via this method . . cause I have awful experiences of it.
I had tried to upgrade by home PC which was running Ubuntu 7.10 Gutsy to Ubuntu 8.04 Hardy, the system downloaded all the required packages but during the installation, everything just stalled, I had to power off my system, and on restarting I couldn't boot into anything, This had happened before too while going from 6.10 to 7.04 also :'( !!!

problem solved I dodwnloaded 8.04 version ubuntu and working fine....

Thanks all who help me..

This question has already been answered. Start a new discussion instead.