Help with "Hello, World" in Java

Discussion in 'Mac Programming' started by mgs27, Sep 13, 2013.

  1. mgs27 macrumors newbie

    Joined:
    Sep 13, 2013
    #1
    Hi, I'm completely new to java and was trying to run the "Hello, World" thing.
    This is what I typed into the terminal window:

    username$ ~/introcs/hello> javac HelloWorld.java

    and this is what I got:
    -bash: /Users/username/introcs/hello: is a directory

    Can anyone tell me what I'm doing wrong??
    Thanks!
     
  2. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #2
    Post the code. What's the class called? It better be called HelloWorld or there will be problems. It's my experience when using javac command-line that the class name better match up with the file name. But maybe that's not your issue.
     
  3. dylanryan macrumors member

    Joined:
    Aug 21, 2011
    #3
    This has nothing to do with the code. The problem is, you are trying to paste the prompt that your teacher included to show you as part of the command.

    Just try this:

    javac HelloWorld.java
     
  4. Mvkoe macrumors member

    Mvkoe

    Joined:
    Aug 4, 2008
    Location:
    Belgium
    #4
    Can't you just use an IDE like eclipse for java and press run ?
     

Share This Page