How to start a Java project in Xcode?
Solution 1
I think what you want is a "JNI Library" project, which has the description "This project builds a Java JNI library with a bundled application wrapper." In Xcode 3.2, this project template can be found under Mac OS X > Framework & Library > JNI Library.
(Edit: This is what Apple officially recommends, too. See this document.)
Solution 2
- Open Xcode 3.2.
- Show the Organizer window (Window->Organizer).
- Click the '+' button in the lower left corner of the Organizer window.
- Choose "New From Template"->"Java Templates"->"Java Application"
Xcode relies on Ant to build Java projects, so you can edit your code in the organizer window or use whatever IDE or editor you wish. Then just open a terminal window, change to the folder's project, and execute ant.
John R Doner
Updated on July 05, 2022Comments
-
John R Doner almost 2 years
I am currently programming Objective-C in the Xcode IDE, and I understand it should also support Java projects. When I open the IDE and choose New Project, I don't find any project templates that correspond to Java. I have Snow Leopard, so I assume my Xcode is up-to-date.
How do I start a Java project in the Xcode IDE?
-
mipadi over 14 yearsThe New Project window has changed from 3.0 to 3.2.
-
David Rodríguez - dribeas over 14 yearsAre you sure? Java Native Interface is a library to interface from java an native code, so I am not sure this would be the option to create a plain Java project.
-
mipadi over 14 yearsI'm not sure. I don't work with Java + Cocoa a whole lot. However, as the description states, it does contain stubs for creating a Java application, as well as stubs for the configuration options needed to create a Mac OS X Java-based application.
-
mipadi over 14 years(Any Java-based Mac OS X app that wants to use the Cocoa framework is going to have to use JNI in some way.)
-
alphazero over 14 yearsI'm running 3.1.2 and its pretty much as straight forward as possible. You have main categories and Java is one of them. Just select that and you have your various templates.
-
John R Doner over 14 yearsThat was the ticket. Thanks.
-
Olie over 13 yearsThis solution gives you a java template, but not the accompanying XCode project, which I believe is what was desired.