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

CANEHDN

macrumors 6502a
Original poster
Dec 12, 2005
855
0
Eagle Mountain, UT
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.
 

CANEHDN

macrumors 6502a
Original poster
Dec 12, 2005
855
0
Eagle Mountain, UT
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

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
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

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
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

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Classes?

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)...
 

jalagl

macrumors 6502a
Jun 5, 2003
802
1
Costa Rica
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

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
CANEHDN said:
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

macrumors 6502a
Original poster
Dec 12, 2005
855
0
Eagle Mountain, UT
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.