LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 10: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, 10: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 05-31-2007, 11:22 PM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
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; 05-31-2007 at 11:24 PM.
 
Old 06-01-2007, 12: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, 01:50 AM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
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



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 02:39 PM
java This.class error when running Fredstar Programming 2 02-12-2006 11:48 PM
´Exception in thread´ error when running Iriverter (java) JungMin Programming 3 12-10-2005 01:29 AM
error running soapstone (java) networking benchmark celejar Linux - Software 0 03-05-2005 07:21 PM
error in running a java app in linux milo36472 Linux - Newbie 16 02-09-2005 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:14 AM.

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
Open Source Consulting | Domain Registration