Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,425
755
United States
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.
 

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,425
755
United States
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.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,731
8,407
A sea of green
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?

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.