Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java & linux

1 view
Skip to first unread message

emin

unread,
Dec 8, 2001, 11:57:09 AM12/8/01
to
I have a problem about the platforms. I wrote an aplication with java.
I can run it on Windows but when I try to run it on linux, it throws
at any time and gives the error seen below. (My program is about the
parsing of an html file, and I use java's present libraries for it.)
What can i do?

Exception in thread "main" java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.Toolkit$2.run(Toolkit.java:498)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:489)
at javax.swing.text.html.CSS.getValidFontNameMapping(CSS.java:932)
at javax.swing.text.html.CSS$FontFamily.parseCssValue(CSS.java:1789)
at javax.swing.text.html.CSS.getInternalCSSValue(CSS.java:531)
at javax.swing.text.html.CSS.addInternalCSSValue(CSS.java:516)
at javax.swing.text.html.StyleSheet.addCSSAttribute(StyleSheet.java:436)
at javax.swing.text.html.HTMLDocument$HTMLReader$ConvertAction.start(HTMLDocument.java:2536)
at javax.swing.text.html.HTMLDocument$HTMLReader.handleStartTag(HTMLDocument.java:1992)
at javax.swing.text.html.parser.DocumentParser.handleStartTag(DocumentParser.java:145)
at javax.swing.text.html.parser.Parser.startTag(Parser.java:333)
at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1786)
at javax.swing.text.html.parser.Parser.parseContent(Parser.java:1821)
at javax.swing.text.html.parser.Parser.parse(Parser.java:1980)
at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:109)
at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:74)
at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:239)
at Search.ParseForUrl(Search.java:64)
at Search.StartSearch(Search.java:45)
at Robot.main(Robot.java:18)

Paul Lutus

unread,
Dec 8, 2001, 12:13:49 PM12/8/01
to
"emin" <euyu...@yahoo.com> wrote in message
news:44b64eae.01120...@posting.google.com...

> I have a problem about the platforms. I wrote an aplication with java.
> I can run it on Windows but when I try to run it on linux, it throws
> at any time and gives the error seen below. (My program is about the
> parsing of an html file, and I use java's present libraries for it.)
> What can i do?

You haven't posted your code, you haven't said what Java or Linux version
you are using, the error message says it cannot find a class for
classForName().

Without seeing the code, and reading through the stack trace, I can only
guess -- it appears that you are specifying a font that is not available on
the machine. Remedy: avoid specifying fonts in your HTML file. This is good
general advice about HTML design in any case.

Parenthetically, recent Red Hat Linux versions have been broken WRT fonts.

--
Paul Lutus
www.arachnoid.com


Nils O. Selåsdal

unread,
Dec 8, 2001, 12:17:32 PM12/8/01
to
Still, you are missing something in your CLASSPATH, Can you do a little
more debugging to find which class it cannot find ?

JustMe

unread,
Dec 9, 2001, 1:31:00 PM12/9/01
to
The stack trace says that line 64 of your Search class is trying something
that results in an error when the runtime tries to instantiate an object
that does not exist on the machine. Wading about half way through the stack
trace reveals that it's probably a missing font. Try puking out a message to
the console right before line 64 and dump what font your program is trying
to access.

"emin" <euyu...@yahoo.com> wrote in message
news:44b64eae.01120...@posting.google.com...

Juergen Kreileder

unread,
Dec 10, 2001, 8:35:21 AM12/10/01
to
euyu...@yahoo.com writes:

> I have a problem about the platforms. I wrote an aplication with
> java. I can run it on Windows but when I try to run it on linux, it
> throws at any time and gives the error seen below. (My program is
> about the parsing of an html file, and I use java's present
> libraries for it.) What can i do?
>
> Exception in thread "main" java.lang.NoClassDefFoundError
> at java.lang.Class.forName0(Native Method) at
> java.lang.Class.forName(Class.java:120) at
> java.awt.Toolkit$2.run(Toolkit.java:498) at

Most likely you get this error because you don't have a connection to
an Xserver (yeah, I know the error message could be more descriptive).
If you don't want to run a real Xserver use Xvfb or a AWT
implementation that doesn't need X (e.g. http://www.eteks.com/pja/en/).


Juergen

--
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux.html
Run Java 2 SE v1.3.1 on your iPAQ:
http://www.handhelds.org/pipermail/ipaq/2001-June/007221.html

Joel Schuster

unread,
Dec 10, 2001, 1:18:58 PM12/10/01
to
This would suggest that the classpath at runtime is not set. Obviously
you have the classpath set when you compile but not when you run. What
does your command line look like when you run? Try using the -cp
option when execing java.

euyu...@yahoo.com (emin) wrote in message news:<44b64eae.01120...@posting.google.com>...

0 new messages