LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-31-2007, 11:06 AM   #1
gamor
Member
 
Registered: Jul 2004
Posts: 77

Rep: Reputation: 15
Error running java


Hello everyone,
When I am running a java code I get this error

Exception in thread "main" java.lang.NoClassDefFoundError: ml.options.Options
at java.lang.Class.initializeClass(libgcj.so.7)
at ToUnicode.main(ToUnicode.java:34)
Caused by: java.lang.ClassNotFoundException: java.lang.Enum not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./,file:/home/ghita/Indri/Transliterator/options.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[file:/usr/share/java-ext/bcprov-jdk14-1.35.jar], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.VMClassLoader.defineClass(libgcj.so.7)
at java.lang.ClassLoader.defineClass(libgcj.so.7)
at java.security.SecureClassLoader.defineClass(libgcj.so.7)
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at java.lang.Class.initializeClass(libgcj.so.7)
...1 more
when I type java -version, that's what I get
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070302 (prerelease) (4.1.2-1mdv2007.1)

I am not sure if it is the version I am running or something else

thanks for your help

rita
 
Old 05-31-2007, 11:59 PM   #2
Coldfire
LQ Newbie
 
Registered: May 2003
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 15
java.lang.Enum was not part of Java 1.4 (which is the version your machine says you are running). Uninstall the gcj Java compiler and download Java 1.5 for Linux from the Sun Java site:

http://java.sun.com/javase/downloads/index_jdk5.jsp

You may not need the SDK if you aren't going to compile Java programs. In that case, get the JRE.

You can also go with Java 6:

http://java.sun.com/javase/downloads/index.jsp

Unpack them somewhere in /usr/local (like /usr/local/java)

You'll have to

Code:
export PATH=$PATH:/usr/local/java/bin
export CLASSPATH=$CLASSPATH:/usr/local/java/jre/lib/rt.jar
to run or compile programs.
 
Old 06-01-2007, 12:22 AM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Well, there actually isn't any real needd to uninstall gcj before installing a jdk. All it does is sae some space. As for the jdk, that should be available straight from your repositories if you use Suse, Debian, Ubuntu, Gentoo, Mandriva, ... (Fedora, CentOS and Slackware are exceptions in this case - these do force you to get and install the jdk yourself).

Last edited by jay73; 06-01-2007 at 12:24 AM.
 
Old 06-01-2007, 01:56 AM   #4
Coldfire
LQ Newbie
 
Registered: May 2003
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 15
I suggested the uninstall and the download from Sun because I have never had anything but problems otherwise. I guess I get picky-I do most development in Java, and I don't like it when things screw with my Java environment.
 
Old 06-01-2007, 02:50 AM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
By using update-alternatives, you can simply switch from gcj to jdk5 or jdk6 and back. It works fine for me. Tomcat 5.5? I switch to jdk5. Tomcat 6? OK, then I use jdk6. Of course, you need to remember what was compiled on which of those three - things could get messy if you don't. From that viewpoint, keeping only one isn't a bad idea at all - but unfortunately there are still plenty of JSP frameworks that won't run with JDK6.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
X11 error with Java Screenshot agent running as a service sboothman Linux - Software 0 05-08-2007 03:39 PM
java This.class error when running Fredstar Programming 2 02-13-2006 12:48 AM
´Exception in thread´ error when running Iriverter (java) JungMin Programming 3 12-10-2005 02:29 AM
error running soapstone (java) networking benchmark celejar Linux - Software 0 03-05-2005 08:21 PM
error in running a java app in linux milo36472 Linux - Newbie 16 02-10-2005 12:44 AM


All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration