I have compiled a list of questions and answers that may be useful to those of you interested in writing, editing, and compiling Java code on a Mac, and don't exactly know where to begin. Hopefully this information will be able to help get you started and on your way. If you have any questions, concerns, or suggestions, feel free to e-mail me!
| Q: | Can I {write | compile | run} Java programs on my Mac? |
| A: | Of course! Mac has great support for Java. In fact, the Java compiler and interpreter, as well as the Applet runner, are built into Mac OS X out of the box. You can even utilize the javac compiler from the Terminal command line. You will only need to create your own .java files (assuming you already know some Java), save them, and compile them. There are, of course, other ways to make this process easier, but we Mac users are fortunate enough to not have to download anything to be able to use Java — Windows users aren't so lucky! |
| Q: | What about Java 1.5 (aka J2SE 5.0)? Is that available on Mac? |
| A: | Yes, Apple has developed a version of Java 1.5 for the Mac. It is available through Apple's Software Update (in the Apple Menu), but may require that the Developer Tools be installed. In fact, Apple already has a version of Java 1.6 in the works. It should be mainstream in the near future and appear in Software Update for all users. For those interested, the latest can be found at: http://developer.apple.com/java/download/. |
| Q: | Will my Java programs perform the same on Mac and PC? |
| A: | Short answer: YES. Long answer: it depends on the way you write the program. If you use strictly pure Java JDK classes, you shouldn't have any problem running your program on different platforms. Sometimes you may encounter wrinkles in the implementation on each platform, and there are a few fundamental differences, but simple programs won't run into these issues. The more often you use images, animations, and complex frameworks, the more likely you are to encounter difficulties on achieving the same result on a different platform. (Sometimes it is a matter of whether it performs the same, although it will run on both platforms.) Also, sometimes you will encounter inconsistencies between the AWT or Swing API's on different platforms, although Apple's implementation is very solid and usually looks much better than its Windows counterpart. |
| Q: | What development tools come with my Mac? |
| A: | Besides the built-in compiler (javac) and interpreter (java), Apple also bundes complete Developer tools with every new Mac. These tools can be found on the Installer disc, and can be installed optionally when you run that installer. These tools include Xcode (known as Project Builder before OS X 10.3), and are intended for writing code using the Cocoa API with either Objective-C or Java, but will also work for other programming languages (like C, C++, Pascal, etc.) or for any general text editing (like HTML, PHP, or JavaScript). These tools are best suited for people who will be writing complete and complex programs -- they are not necessary if you are planning to write simple command-line console programs or applets, although you will find them indispensable for advanced native Mac programming. However, they can also be used for the simplest of programs by merely creating a new source code file (or opening it with that program) without having to create a project file. |
| Q: | What other tools are available, and how do I get started? |
| A: | Although the javac compiler is accessible from the Terminal window, some of us aren't really excited about trading the Aqua GUI interface for a UNIX command line. That's why there are other programs available. Eclipse is a very powerful an extensible full-featured cross-platform IDE written in Java, and it's free. Novice users may want to consider solutions other than the Developer tools described above. JJEdit is one of the simplest and cheapest, and basically acts as a graphical front-end to the built-in Unix-based tools. My favorite editor is SubEthaEdit, which not only recognizes dozens of programming languages, but also enables multiple people to work on the same file simultaneously. The downside is that it doesn't have integrated compiling — you'll still need to use the command line for that. |
| Q: | Should I buy commercial development software? |
| A: | It really depends on the level of programming you want to do. If you will be starting out writing simple programs, there's really no need to buy commercial development software. Plus, if you plan on programming strictly for the Mac, the Xcode development tools will most likely be all you need. However, if you plan on writing extremely involved software for customizing on multiple platforms, the structure and templates of third-party software can really be a big timesaver. The best idea is probably to start out with the basics, and work your way up later if you need to. |
| Q: | What if I want to send my projects to another computer? |
| A: | There are a few great options. My personal favorite is to use a graphical FTP (File Transfer Protocol) program. If the computer you want to send your files to supports remote FTP access, and you can get the FTP address and login info, this is probably your best option for transferring files. Such programs for the Mac include Transmit ($30), Fetch ($25, free for educational users), and Fugu (free, open source). The software you prefer may depend on your taste, computer expertise, and pocketbook. Mac OS X also includes the built-in capability to do FTP and SSH transfer via the Terminal window (Unix command prompt), if you are so inclined. Other options include using e-mail, ZIP disks, USB pocket drives, or even a direct network connection to transfer files between two computers. If you use a disk, you should of course verify that the destination computer also supports the same type of disk as your computer. If you want to transfer files between Mac and PC, you can usually use a PC disk on your Mac without a problem. |



