PDA

View Full Version : Java in XCode




CANEHDN
Feb 15, 2006, 01:57 AM
I am currently a student studying programming and want to use my new iMac for programming in Java. I've looked at XCode a few times and it's kind of confusing. I currently use JCreator for windows and it's really easy to use. Is there any way to just make a new Java project without having to figure out which Java option to select. There are 6 different options to choose from and I'm not sure which one I should choose.



bousozoku
Feb 15, 2006, 02:07 AM
You might list the options since we might not know what they are.

CANEHDN
Feb 15, 2006, 02:22 AM
Sorry. When I open JCreator it just opens a new page and lets you code. In XCode you have a plethera of options. The main ones I'm looking at using would be Java AWT Applet, Java AWT Application, JAVA JNI Application, Java Swing Applet, Java Swing Application, and Java Tool. I understand what AWT and Swing are but how do I know exactly which one to choose. Why can't I just open a new page and create code in Java like I can with JCreator.

HiRez
Feb 15, 2006, 04:03 AM
I think it mostly has to do with what environment you want the applications to run in and if you want some commonly-used things set up for you. To run in a browser, you would choose one of the Applet types, for a double-clickable application, choose one of the Application types. The project types basically just give you a skeleton to build from (windows, menus, etc.). For example, the Swing type sets up Swing menus and windows (JFrames), which the AWT type does the same with AWT components (Frame, etc.). If you don't want any of that set up for you, just choose the Java Tool type, where you'll do everything manually. I think that would be the closest to the traditional "blank Java project" that you're looking for (also would be used for creating command-line tools). But, this will give you a JAR file in the end, not a double-clickable application. You might want to just start by skipping Xcode and using a text editor and Terminal to compile and run. It won't manage a large project for you, but it's simpler than using Xcode.

bousozoku
Feb 15, 2006, 05:06 AM
Java Tool is generally a blank application in Xcode. (Sorry, I thought that you were talking about the project types in JCreator, which I haven't seen.) The same goes for the various Tool projects for other languages--they're the simplest.

Eraserhead
Feb 15, 2006, 06:14 AM
If you are doing a basic java course aren't you just creating .class files??

Xcode is pretty good, I do it by creating a ANT-based application jar, but a java Tool seems to work too... and then xcode creates the directory structure...
once you click on those click on the Project Name.java file and then you can start coding (you may want to delete the contents, which display a Hello World message first...

As I get template files on my java course, I name the project after the main file and then replace it with the template in the /Project path/src/ directory...
and then add any addition files with Add to Project in the Project Menu...

The best thing about XCode is that you can re-indent the lines so you never have to organise your code (it gives you bad habits though)...

jtalerico
Feb 15, 2006, 06:33 AM
If you want a bunch of crap with your tools try NetBeans...

jalagl
Feb 15, 2006, 07:07 AM
Try Eclipse 3.1 or higher. It works great on OSX.

I couldn't stand XCode personally, but I know several people that like it.

savar
Feb 15, 2006, 08:24 AM
Sorry. When I open JCreator it just opens a new page and lets you code. In XCode you have a plethera of options. The main ones I'm looking at using would be Java AWT Applet, Java AWT Application, JAVA JNI Application, Java Swing Applet, Java Swing Application, and Java Tool. I understand what AWT and Swing are but how do I know exactly which one to choose. Why can't I just open a new page and create code in Java like I can with JCreator.

Because you're using an IDE, and its not designed for doing CS homework. I'd suggest that you not use XCode or JCreator to compile your assignments. You can always just create an empty .java file by itself and write your assignment into there and then compile it from Terminal. This is what I did in school mostly.

In most CS classes, by the way, you'd want to use the Java Tool template. In some cases you'd use Swing Application. I've never heard of writing Applets in CS classes, and I doubt anybody still teaches AWT.

CANEHDN
Feb 15, 2006, 09:32 AM
I love using JCreator. One reason for that is probably because I started using it. I'll try using the Tool option and see what happens. I will also have to give Excplise a try. Thanks for the help guys.