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

jamdr

macrumors 6502a
Original poster
Jul 20, 2003
659
0
Bay Area
Does OS X come with a Java compiler? If not, does anyone know where can I get a compiler? Thanks.
 
It's part of the developer tools disc that comes with every copy of Mac OS X or pre-loaded onto new machines.
 
Yeah, thanks. I just realized that it should be on my computer, but I did a custom install and didn't install the Developer Tools. I tried to install them from Restore CD, but it won't let me add something, I would have to erase my current system and install it all over again (or archive it). Is there a way I can just install it on top of my current system?
 
Are you sure that you don't have an installation folder within the Applications folder? That's where they were on my system from the restore CD-ROMs.

The only other solution I can imagine is that I hav e an extra CD-ROM with tools that ADC just sent me, so if you need the one I got with Panther, you're welcome to it.
 
Thanks for your response. I had reinstalled my system earlier, and so didn't have that install folder, but my friend had it on his iBook so I installed it from there. But now that I have XCode, I can't figure out how to run a simple Java class. I don't want to create an entire application, I just want to test a few lines of code. Is this possible in XCode? I'm not used to Mac programming at all, so I would just like to try some things before I create a project. Is there a way to compile and run just one class?
 
1. Put the developer tools disk in and double-click the installer.

2. You don't need to use Xcode to compile a few lines. Just use vi and javac in Terminal, like any normal Unix computer.
 
Originally posted by cubist
1. Put the developer tools disk in and double-click the installer.

2. You don't need to use Xcode to compile a few lines. Just use vi and javac in Terminal, like any normal Unix computer.

Or TextEdit and javac.

IfI could remember the extension and other java thingies I would test a theory that all you would have to do is write it in TextEdit and double click.
 
Wow, javac, that's obvious. Thanks. I keep forgetting OS X even has a terminal. This is going to take a while to get used to.
 
Originally posted by Doctor Q
Where is a good tutorial on using Xcode to write HelloWorld in Java?

Actually, if you just open Xcode, create a new Java tool project, that should take care of everything, including the "Hello World!" code.
 
reading this thread, i remembered an email I got from the studentdev mailing list, this guy was asking what a good and free c++ compiler was. :)
It was pretty funny sorta, because I burst out laughing because of the absurd question. Sounds like most people in there don't know what gcc is, they're just saying you can use Xcode/Project Builder to do it.

http://lists.apple.com/mhonarc/studentdev/msg10901.html
 
Well, really, you could replace gcc with any other compiler and have Xcode call it when compiling code and most developers wouldn't notice on small projects. ;)

Sun's Java compiler can be replaced with IBM's jikes just fine too.
 
Java Compiler in Terminal?

Hey, can someone explain to me how to compile a .java file I have already coded so that it can run as executable on my desktop (or anyone else's desktop for that matter). I coded it in NetBeans, it runs fine. But now I want to make it a .app like the other programs on my OS X. Thanks. Appreciate it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.