Start New Discussion within our Software Development Community


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 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.


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)

This question has already been answered. Start a new discussion instead.