FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

JAVA Trouble

 


Xavier
I decided to try out the Java tutorials at the Sun Microsystems Website, But I ran into some problems. See if you can help me out.

I've already installed the latest JDK, 6b2.

I followed the instructions here : http://java.sun.com/docs/books/tutor...java/unix.html , and copied the following code and saved it as HelloWorldApp.java


Code:
Quote:
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}


It compiles fine, but when I try to run it, I get this mess :


Code:
Quote:
sykora@nexus projects/> javac HelloWorldApp.java
sykora@nexus projects/> java HelloWorldApp
Exception in thread "main" java.lang.ClassFormatError: HelloWorldApp (unrecognized class file version)
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 gnu.java.lang.MainThread.run (libgcj.so.7)
sykora@nexus projects/>


Can anyone tell me what I'm doing wrong? Is it the code which is bad (I doubt) or have I installed the wrong binaries? Or is it something else?
LethcanAernis
My guess you have too new Java.. does yoru tutorial tells you what version they use? if so use that one. Maybe you call a class that has been moved, renamed or gone in the latest Java.
internetjobs
do the folling steps

1. simply rename u r file

2. set java path including classpath to current directory

go to environment variable and set the path
muggle
Please provide more details.
I see the libgcj.so.7 name in your output, which more likely is part of GNU Compiler for Java environment. From the beginning of your post I assume that you're trying Sun's Java.
Maybe they are some confusing settings on your machine.
Reply to topic    Frihost Forum Index -> Computers -> Computer Problems and Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.