1.11M Members

Error Java

 
0
 

Hi,

I just started programming in Java, and now i tried to compile a file with the Mac Terminal (Command-line),
but it did only give me an error which i couldn't explain, because this code did work in Eclipse compiler.

Here's my code:

class HelloWorldApp 
{
    public static void main (string [] args)
    {
        System.out.println("Hello World!"); // Display the string.
    }
}

(Yes, i can do better, i just wrote this to see if i could compile something with the command-line.)

and this is what i did:


Last login: Fri Sep 2 18:06:02 on ttyp1
Welcome to Darwin!
computer-van-****************:~ ***************$ cd bureaublad
-bash: cd: bureaublad: No such file or directory
computer-van-****************:~ ***************$ cd desktop
computer-van-****************:~/desktop ***************$ javac HelloWorldApp.java
HelloWorldApp.java:3: cannot find symbol
symbol : class string
location: class HelloWorldApp
public static void main (string [] args)
^
1 error
computer-van-****************:~/desktop mauritskoelmans$


(I've replaced my name with little stars (*))


I don't think i did something wrong with the code, but i think it has something to do with the command-line.

Thanks

 
0
 

Sorry for posting this useless thread, i solved my own problem.
It's very dumb actually, i jut had to type

public static void main (String [] args)

instead of

public static void main (string [] args)

Question Self-Answered as of 2 Years Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: