We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,620 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Error Java

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

1
Contributor
1
Reply
4 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
11684
Newbie Poster
2 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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)

11684
Newbie Poster
2 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 1 Year Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0600 seconds using 2.69MB