FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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.
Related topics
Java Game
Java
Add to favorites script - Java
Problems with Java
hi ive got a question
Java Programming Introductory
Programming Help & Support Guidelines
Language
DSP Tutorial with Java Applets
Java
Problem with javax.sound.midi (Java)
Stranged thing ever happend on your pc
Rs2 Server Java Coding projects
Java runtime problem
Reply to topic    Frihost Forum Index -> Computers -> Computer Problems and Support

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