PDA

View Full Version : Java in Xcode 3.2?




Watabou
Oct 23, 2009, 02:34 AM
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.



Cromulent
Oct 23, 2009, 03:34 AM
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?

Yes. You need to edit the source file in the src directory that is included in the Java Tool project. Or delete it.

Watabou
Oct 23, 2009, 02:13 PM
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
Oct 25, 2009, 03:05 PM
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:

Main-Class: YourClassnameHere


If your main class is defined in a package, such as:

package my.fun.pkg;

public class MyMain
{ ...main method here... }


Then YourClassnameHere would be this fully qualified class-name: my.fun.pkg.MyMain