How to start a Java project in Xcode?

72,872

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

  1. Open Xcode 3.2.
  2. Show the Organizer window (Window->Organizer).
  3. Click the '+' button in the lower left corner of the Organizer window.
  4. 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.

http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html

Share:
72,872
John R Doner
Author by

John R Doner

Updated on July 05, 2022

Comments

  • John R Doner
    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
    mipadi over 14 years
    The New Project window has changed from 3.0 to 3.2.
  • David Rodríguez - dribeas
    David Rodríguez - dribeas over 14 years
    Are 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
    mipadi over 14 years
    I'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
    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
    alphazero over 14 years
    I'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
    John R Doner over 14 years
    That was the ticket. Thanks.
  • Olie
    Olie over 13 years
    This solution gives you a java template, but not the accompanying XCode project, which I believe is what was desired.