PDA

View Full Version : learning java


Low
Nov 1, 2003, 08:52 PM
hi guys, i wanna learn java. i know some vb and maybe a tad bit c++ if i can remember hard enough, lol. i learned all on PC platform though, and i just recently made the switch. i just upgraded to panther and was wondering if there was a built in complier or something for java in here. can anyone point me in the right direction to start some beginner development in java? i wanna work off my powerbook so what do i need?

Taft
Nov 1, 2003, 09:25 PM
Originally posted by Low
hi guys, i wanna learn java. i know some vb and maybe a tad bit c++ if i can remember hard enough, lol. i learned all on PC platform though, and i just recently made the switch. i just upgraded to panther and was wondering if there was a built in complier or something for java in here. can anyone point me in the right direction to start some beginner development in java? i wanna work off my powerbook so what do i need?

Panther comes with a third disc containing the Apple developer tools (now all under the "XCode" umbrella). The java compiler comes with these tools. Just install XCode and you'll install everything you need to develop in Java.

Once you've installed XCode, open up your Terminal application (located in Applications->Utilities). Type 'javac' on the command line. You should see the usage statement for the java compiler. This should let you know if the java development tools are correctly installed.

After that, you can dig right in. Use javac to compile your .java source code files and java to run your programs from the compiled .class files. Alternately, you can use the XCode IDE to create, compile and run Java projects. In the end, either method should yield the same results (except if you want to create "native" Java programs for Mac OS X, in which case you are forced to use XCode).

For a tutorial on Java development, go here: http://developer.java.sun.com/developer/onlineTraining/ There are tutorials on just about every aspect of the Java language. Also sun.java.com has some more vital information on Java, including full Java API documentation.

FYI, the version of Java that comes with Panther is 1.4.1.

Taft

debo
Apr 21, 2004, 03:14 PM
Sorry, I know this post is old, but How can I just open a java file in xcode, and then compile it? (without using javac)

King Cobra
Apr 21, 2004, 03:55 PM
Taft, it's actually the fourth disk in the Panther box. The first three relate directly to the workings [sic] of the OS.

Sorry, I know this post is old, but How can I just open a java file in xcode, and then compile it? (without using javac)

Technically, you're supposed to create a project first, then a target, then add target files, THEN hit the build and run option, which I never figured out successfully. But don't bother trying to go through all that nonsense anyways (unless you would die to find out how to fix a variable in an app while its running and have the changes reproduced).

When I asked this question to people in the IRC chat room, and to others on AIM, about why the Build & Run option wasn't in my Xcode window (thinking that Xcode would be such a simple app to use), I either got a laugh in the face ("lol" or "LOL" etc.), a response that said: "Xcode sucks," and/or a recommendation for another product.

So out of the three responses that I received in turn (see above paragraph), I'm going to return the favor with two recommendations. Download JGrasp and (unless your computer is less than a 400MHz G3) IBM Eclipse.

JGrasp (http://spider.eng.auburn.edu/user-cgi/grasp/grasp.pl?;dl=download_jgrasp.html) - Small, simple, and fairly fast application.

Eclipse (http://download2.eclipse.org/downloads/index.php) (version 3.0M8) - A very "heavy" application in comparison, but tells you, as you're coding, the instant you type up something wrong in your code. This program has a learning curve of at least an hour, so become familiar with it before you get into the meat using it. Also, you can create stand-alone apps using Eclipse...this is nice for me because JarBuilder (the OS X dev. disk utility that does the same) crashes almost every time I try to add a custom icon. This program requires project creations and adds files automatically to your project folder when you put them in.

You can work back and forth between the applications, as well.

debo
Apr 21, 2004, 04:38 PM
Yeah, I use Jgrasp, I just thought like you, that Xcode could do the same type stuff easily.

bousozoku
Apr 21, 2004, 08:30 PM
Yeah, I use Jgrasp, I just thought like you, that Xcode could do the same type stuff easily.

Xcode is good if you want to start a Java application, especially if it's just for Mac OS X--so much for pure Java.

jGrasp is my favourite with Eclipse and Sun's NetBeans not far behind it. NetBeans will create GUI elements visually, so it's quite useful.