getting started with java and xcode

Discussion in 'General Mac Discussion' started by abhishekit, Apr 23, 2004.

  1. abhishekit macrumors 65816


    Nov 6, 2003
    akron , ohio
    I am trying to get started with java...using i m a total beginner to java as well as xcode..can someone please give me simple steps how to compile n run a java program on xcode, as a standalone this
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); //Display the string.
    when i open xcode, what should i select as new project..if i select java awt app, it makes a bunch of files..keeps indexing lot of .class files...and if i double click on .java file in that already has a whole lot of code..
    so can anyone please help....
    thanks a lot...i wd really appreciate it
  2. janey macrumors 603


    Dec 20, 2002
    sunny los angeles
    java, javac

    the cli is your best friend :)

    to start with, just use an app like SubEthaEdit, save the file, compile, run, etc. No need to use Xcode when you're just starting ;)
  3. robbieduncan Moderator emeritus


    Jul 24, 2002
    You do not want an AWT App (for this case). AWT = Abstract Window Toolkit. If you choose that you are building a cross-platform GUI application so XCode generates a lot of the boiler plate stuff for you. If you want a command line app the choose Java Tool (the last item in the Java templates for me).
  4. varmit macrumors 68000


    Aug 5, 2003
    Just choose Java AWT Applet

    But they all do the hello world thing, so you can choose any way of doing Java and the world thing will be in there already. Read their code and see how it works.

    EDIT: Might also want to look into doing it with Cocoa-Java, get the interface of Cocoa and code of Java. It makes making a gui program so easy because you can create the Java code from the interface you create in interface builder.
  5. abhishekit thread starter macrumors 65816


    Nov 6, 2003
    akron , ohio
    thanks guys...beginning to understand it now..
  6. G5orbust macrumors 65816


    Jun 14, 2002
    ARGGH dont use xcode. Its interface is really too slow and convoluted, especially for a basic Java programmer. I suggest trying Netbeans or Jext instead. Much better interfaces, though Netbeans kind of has a PC GUI look to it and accepts only PC functions (i.e.: its control-c to copy, not command/apple-c). Netbeans has some really neat functions, like red underlining of code that is incorrect and finding of braces that dont match up (makes it much easier to run a program knowing the basic problems such as syntax are taken care of precompilation). Jext is very simple and runs fast, though you need to compile from the terminal if you use it.

    I suggest making a single folder for all your code for easy compiling. Put it in your documents folder and every time you need to compile from the terminal type:

    cd /Users/(your user name)/Documents/(folder name)

    Afterwards to compile type:
    javac (file name).java

    And to run the program after compiling:
    java (filename)

    Simple as that.

    public class HelloWorld
    public static void main(String[] args)
    System.out.println("Hello world");
  7. mms macrumors 6502a

    Oct 8, 2003
    Can anyone recommend any good sites for getting started with Java?
  8. bousozoku Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    I would suggest for most any programming information, including Macintosh-specific issues. You can also go to

Share This Page