Using Java in Xcode 4?

Discussion in 'Mac Programming' started by coldcrow, Mar 14, 2011.

  1. coldcrow macrumors newbie

    Joined:
    Mar 14, 2011
    #1
    Is it possible to use the Java language in Xcode 4? I had the impression it did from reading Wikipedia. Maybe I just misunderstand.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    I know it definitely used to. But Apple deprecated the use of Java as a first-class language for developing Mac software and so the templates may be gone now.

    I've never used XCode for Java development, so I couldn't say how to manually setup a Java project without the templates.
     
  3. coldcrow thread starter macrumors newbie

    Joined:
    Mar 14, 2011
    #3
    Yeah, I had a project that was built in NetBeans and I was hoping I could port it instead of learning another language. It would just be quicker and easier for me. :D
     
  4. chown33, Mar 14, 2011
    Last edited: Mar 14, 2011

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    I'm not sure what the problem is. NetBeans runs on Mac OS X. Java runs on Mac OS X. You can use NetBeans to develop Java on Mac OS X.

    Java development on Mac OS X doesn't require Xcode. It doesn't require NetBeans, either. You could use Eclipse if you wanted to. Or you could use any text editor plus Ant. Or any text editor plus a makefile.

    You can even compile the Java source into class-files or jars on another platform, then transfer the jars to the Mac, and they will run. Simply target Java 6 and don't use JNI. That should run fine as-is on any Snow Leopard Mac.

    If you have JNI libraries, then those have to be compiled for the Mac. That's where you might find Xcode useful. Or if you have a makefile already, you may find that easier to use, even if you have to make changes to it. You will also have to compile for i386 (32-bit) and x86_64 (64-bit), linked as a universal binary, since you might not have full control over which JVM executes on the Mac.
     
  5. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #5
    Java is one of the major languages I use and I use Netbeans on the Mac (as well as Windows and Linux). I can't see any reason to use XCode for that.

    I've also been experimenting with Netbeans for Qt programming on the Mac and Linux as well. Not sure I can ever persuade myself to use XCode and Cocoa for anything since I'm not interested in the Mac App Store.
     
  6. coldcrow thread starter macrumors newbie

    Joined:
    Mar 14, 2011
    #6
    I can't use netbeans for a iPhone application can I? I thought iPhone applications can only run Object C language.
     
  7. vocaro macrumors regular

    Joined:
    Mar 5, 2004
    #8
    Xcode 4 has a JNI application template, so the support for Java isn't entirely gone.
     

Share This Page