Can Xcode 4.5.1 compile/run java?
Can Xcode 4.5.1 compile/run java?
Apple Event: May 7th at 7 am PT
Can Xcode 4.5.1 compile/run java?
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.
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.
But how can I tell the project to use the Java compiler? It fails to run it.
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.
isint the Java compiler in '/usr/bin'? I tried putting that in build tool but it fails to compile.
What did you enter for the build tool?
/usr/bin
Or
/usr/bin/javac (Assuming you're using the javac compiler)
You have to supply the full path to the Java compiler. Supplying /usr/bin won't work.
I tried both and neither worked
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.
It's installed but idk. I just wanted to use XCode since I dont car efor Netbeans and Eclipse doesn't want to work with C/C++ for me. But thanks for your help.
One more thing to try. You may have to add the names of the Java files you're compiling to the Arguments text field, which you can see in the screenshot I posted earlier in this thread.
I did the same thing. it gives an error saying :
Command /usr/bin/javac failed with exit code 2. pleasehelp.
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.
okay! Thanks, mark. i'll try textmate then.
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.
okay. but how do you do that? how to add language into xcode?
Can Xcode 4.5.1 compile/run java?