View Full Version : getting started with java and xcode

Apr 24, 2004, 01:18 AM
I am trying to get started with java...using xcode..so i m a total beginner to java as well as xcode..can someone please give me simple steps how to compile n run a java program on xcode, as a standalone app..like this
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
when i open xcode, what should i select as new project..if i select java awt app, it makes a bunch of files..keeps indexing lot of .class files...and if i double click on .java file in that list...it already has a whole lot of code..
so can anyone please help....
thanks a lot...i wd really appreciate it

Apr 24, 2004, 01:29 AM
java, javac

the cli is your best friend :)

to start with, just use an app like SubEthaEdit, save the file, compile, run, etc. No need to use Xcode when you're just starting ;)

Apr 24, 2004, 03:50 AM
You do not want an AWT App (for this case). AWT = Abstract Window Toolkit. If you choose that you are building a cross-platform GUI application so XCode generates a lot of the boiler plate stuff for you. If you want a command line app the choose Java Tool (the last item in the Java templates for me).

Apr 24, 2004, 11:52 AM
But they all do the hello world thing, so you can choose any way of doing Java and the world thing will be in there already. Read their code and see how it works.

EDIT: Might also want to look into doing it with Cocoa-Java, get the interface of Cocoa and code of Java. It makes making a gui program so easy because you can create the Java code from the interface you create in interface builder.

Apr 24, 2004, 12:13 PM
thanks guys...beginning to understand it now..

Apr 24, 2004, 03:09 PM
ARGGH dont use xcode. Its interface is really too slow and convoluted, especially for a basic Java programmer. I suggest trying Netbeans (http://www.netbeans.org/downloads/ide/index.html) or Jext (http://prdownloads.sourceforge.net/jext/jext-3.2pre3.tar.gz) instead. Much better interfaces, though Netbeans kind of has a PC GUI look to it and accepts only PC functions (i.e.: its control-c to copy, not command/apple-c). Netbeans has some really neat functions, like red underlining of code that is incorrect and finding of braces that dont match up (makes it much easier to run a program knowing the basic problems such as syntax are taken care of precompilation). Jext is very simple and runs fast, though you need to compile from the terminal if you use it.

I suggest making a single folder for all your code for easy compiling. Put it in your documents folder and every time you need to compile from the terminal type:

cd /Users/(your user name)/Documents/(folder name)

Afterwards to compile type:
javac (file name).java

And to run the program after compiling:
java (filename)

Simple as that.

public class HelloWorld
public static void main(String[] args)
System.out.println("Hello world");

Apr 26, 2004, 09:39 PM
Can anyone recommend any good sites for getting started with Java?

Apr 26, 2004, 10:35 PM
Can anyone recommend any good sites for getting started with Java?

I would suggest http://www.oreillynet.com/ for most any programming information, including Macintosh-specific issues. You can also go to http://java.sun.com.