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

coldcrow

macrumors newbie
Original poster
Mar 14, 2011
6
0
Is it possible to use the Java language in Xcode 4? I had the impression it did from reading Wikipedia. Maybe I just misunderstand.
supports C, C++, Objective-C, Objective-C++, Java, AppleScript, Python and Ruby source code with a variety of programming models, including but not limited to Cocoa, Carbon, and Java.
 
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.
 
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
 
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

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.
 
Last edited:
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.
 
I can't use netbeans for a iPhone application can I? I thought iPhone applications can only run Object C language.
 
Apple deprecated the use of Java as a first-class language for developing Mac software and so the templates may be gone now.

Xcode 4 has a JNI application template, so the support for Java isn't entirely gone.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.