Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can Xcode 4.5.1 compile/run java?

Can Xcode 4.5.1 compile/run java?

Posted on Oct 17, 2012 10:02 AM

Reply
Question marked as Best reply

Posted on Oct 17, 2012 11:18 AM

Yes, it can. Create an external build system project in Xcode. Tell the project to use the Java compiler as the build tool.


While Xcode can compile Java code, it's not the best tool for doing so. Eclipse and Netbeans support Java better than Xcode.

14 replies

Oct 17, 2012 9:06 PM in response to CalvinKit

When you create the project, there is a Build Tool text field. Enter the path to the Java compiler there.


If you've already created the project, select the project from the project navigator on the left side of the project window to open the project editor. Select your target from the left side of the project editor. Click the Info button at the top of the editor. Enter the path to the Java compiler in the Build Tool text field.


User uploaded file

Oct 18, 2012 2:46 PM in response to day-day

Have you looked in /usr/bin and checked that the Java compiler is there? If no compiler is there, you're going to have install it. If the compiler is there and the build tool doesn't work, I don't have an answer for you to get it to work in Xcode. Use another IDE like Eclipse or Netbeans that has better Java support. Or use TextMate 2, which has a bundle that lets you compile and run Java code from TextMate.

Jan 8, 2013 11:42 AM in response to archit4

Archit,


I don't use Xcode for Java. I don't have anything to add besides restate what I stated on Oct. 18.


If the compiler is there and the build tool doesn't work, I don't have an answer for you to get it to work in Xcode. Use another IDE like Eclipse or Netbeans that has better Java support. Or use TextMate 2, which has a bundle that lets you compile and run Java code from TextMate.


I recommend downloading TextMate 2. It's free and it's pretty easy to compile Java code with it. Choose Bundles > Java > Compile and Run.

Jan 11, 2013 6:50 AM in response to archit4

It is always best to start your own question instead of piggy-backing on someone else's months-old question.


Java is no longer part of OS X. If you want to use Java, or any other language that does not come with Xcode, then you must install it separately. Then you can use it in Xcode. It is best to use makefile-based projects with 3rd party languages. It is possible to closely integrate them into Xcode the same way that LLVM is integratd, but it can be quite a bit of work.

Can Xcode 4.5.1 compile/run java?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.