Java in XCode

Discussion in 'Mac Programming' started by CANEHDN, Feb 14, 2006.

  1. macrumors 6502a

    CANEHDN

    Joined:
    Dec 12, 2005
    Location:
    Eagle Mountain, UT
    #1
    I am currently a student studying programming and want to use my new iMac for programming in Java. I've looked at XCode a few times and it's kind of confusing. I currently use JCreator for windows and it's really easy to use. Is there any way to just make a new Java project without having to figure out which Java option to select. There are 6 different options to choose from and I'm not sure which one I should choose.
     
  2. Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #2
    You might list the options since we might not know what they are.
     
  3. thread starter macrumors 6502a

    CANEHDN

    Joined:
    Dec 12, 2005
    Location:
    Eagle Mountain, UT
    #3
    Sorry. When I open JCreator it just opens a new page and lets you code. In XCode you have a plethera of options. The main ones I'm looking at using would be Java AWT Applet, Java AWT Application, JAVA JNI Application, Java Swing Applet, Java Swing Application, and Java Tool. I understand what AWT and Swing are but how do I know exactly which one to choose. Why can't I just open a new page and create code in Java like I can with JCreator.
     
  4. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    I think it mostly has to do with what environment you want the applications to run in and if you want some commonly-used things set up for you. To run in a browser, you would choose one of the Applet types, for a double-clickable application, choose one of the Application types. The project types basically just give you a skeleton to build from (windows, menus, etc.). For example, the Swing type sets up Swing menus and windows (JFrames), which the AWT type does the same with AWT components (Frame, etc.). If you don't want any of that set up for you, just choose the Java Tool type, where you'll do everything manually. I think that would be the closest to the traditional "blank Java project" that you're looking for (also would be used for creating command-line tools). But, this will give you a JAR file in the end, not a double-clickable application. You might want to just start by skipping Xcode and using a text editor and Terminal to compile and run. It won't manage a large project for you, but it's simpler than using Xcode.
     
  5. Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #5
    Java Tool is generally a blank application in Xcode. (Sorry, I thought that you were talking about the project types in JCreator, which I haven't seen.) The same goes for the various Tool projects for other languages--they're the simplest.
     
  6. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #6
    Classes?

    If you are doing a basic java course aren't you just creating .class files??

    Xcode is pretty good, I do it by creating a ANT-based application jar, but a java Tool seems to work too... and then xcode creates the directory structure...
    once you click on those click on the Project Name.java file and then you can start coding (you may want to delete the contents, which display a Hello World message first...

    As I get template files on my java course, I name the project after the main file and then replace it with the template in the /Project path/src/ directory...
    and then add any addition files with Add to Project in the Project Menu...

    The best thing about XCode is that you can re-indent the lines so you never have to organise your code (it gives you bad habits though)...
     
  7. macrumors 6502

    Joined:
    Nov 23, 2005
    #7
    If you want a bunch of crap with your tools try NetBeans...
     
  8. macrumors 6502a

    jalagl

    Joined:
    Jun 5, 2003
    Location:
    Costa Rica
    #8
    Try Eclipse 3.1 or higher. It works great on OSX.

    I couldn't stand XCode personally, but I know several people that like it.
     
  9. macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #9
    Because you're using an IDE, and its not designed for doing CS homework. I'd suggest that you not use XCode or JCreator to compile your assignments. You can always just create an empty .java file by itself and write your assignment into there and then compile it from Terminal. This is what I did in school mostly.

    In most CS classes, by the way, you'd want to use the Java Tool template. In some cases you'd use Swing Application. I've never heard of writing Applets in CS classes, and I doubt anybody still teaches AWT.
     
  10. thread starter macrumors 6502a

    CANEHDN

    Joined:
    Dec 12, 2005
    Location:
    Eagle Mountain, UT
    #10
    I love using JCreator. One reason for that is probably because I started using it. I'll try using the Tool option and see what happens. I will also have to give Excplise a try. Thanks for the help guys.
     

Share This Page