Java in Xcode 3.2?

Discussion in 'Mac Programming' started by Watabou, Oct 23, 2009.

  1. macrumors 68030

    Watabou

    Joined:
    Feb 10, 2008
    Location:
    United States
    #1
    I just downloaded Xcode 3.2 and found out that there's no Java templates. I searched and found that I can go to the Organizer and open a Java tool project from there.But I don't know where to go from there. I tried creating a test file consisting of a simple for loop in the java tool project and tried running it but it instead runs a Hello World class. Am I doing something wrong?

    I'm trying to learn java and I'm in a beggining java class in college. And please don't suggest Eclipse or any other IDE. I have my own reasons for trying out Xcode.
     
  2. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Yes. You need to edit the source file in the src directory that is included in the Java Tool project. Or delete it.
     
  3. thread starter macrumors 68030

    Watabou

    Joined:
    Feb 10, 2008
    Location:
    United States
    #3
    There's one java file in the src folder called Java_Tool.java. If I try to edit that or delete that file and add a file of my own in the src folder, and try to run it, it gives me an error that says build xml not found.
     
  4. macrumors 603

    Joined:
    Aug 9, 2009
    #4
    If you want to run a different main class, you have to edit the Manifest file under "resources" in the Organizer project. At a minimum it should contain:

    Code:
    Main-Class: YourClassnameHere
    
    If your main class is defined in a package, such as:

    Code:
    package my.fun.pkg;
    
    public class MyMain
    { ...main method here... }
    
    Then YourClassnameHere would be this fully qualified class-name: my.fun.pkg.MyMain
     

Share This Page