#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    132
    Rep Power
    3

    Hello World does not compile and run


    Hi guys.
    please bare with me, since i'm making my first steps in Java programming, and i'm having a problem making "Hello World" program.

    I'm using Eclipse KEPLER as IDE, I created a new Java project, and a new HelloWorld class, and typed this in:

    Code:
    public class HelloWorld {
    	
    	public static void main(string []args) {
    		System.out.println("Hello World!");
    	}
    }
    as it's said so in this tutorial (the just called it "MyFirstJavaProgram").

    problem is, Eclipse points out a "string cannot be resolved to a type" error under the 'string' type.

    Thank you in advanced!
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    Have you also installed the JDK?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    132
    Rep Power
    3
    Originally Posted by bullet
    Have you also installed the JDK?
    Hi bullet.
    I'm not sure, but I think it is already installed:
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    132
    Rep Power
    3
    OK, I just noticed that it is also does not work when I try to run the same program from the command line...



    and by the way, why does 'main' have to get string as parameter anyway?
  8. #5
  9. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    Oops sorry. I didn't notice the spelling. Java is case-sensitve.

    Note that you have string

    The class is String

    The array of String parameter is required. They can allow you to send input from the command line to the program.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    132
    Rep Power
    3
    Originally Posted by bullet
    Oops sorry. I didn't notice the spelling. Java is case-sensitve.

    Note that you have string

    The class is String

    The array of String parameter is required. They can allow you to send input from the command line to the program.
    Nice!
    it works through the command line. (didn't try Eclipse. I relized I better off completing the tutorial from the command line, since a basic text editor will not protect me from errors that are essential for the learning process).

    thank you.

IMN logo majestic logo threadwatch logo seochat tools logo