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

Amigori

macrumors newbie
May 2, 2005
9
0
Toledo, OH
Here's a few places to check:

~/$ProjectName
/Users/$HomeDir/$ProjectName (same dir as above, just the full structure)
/Developer/$ProjectName

Within XCode, you can press Apple+I and it will show where its at.
e.g "Path: /Users/$HomeDir/Projects/$ProjectName"
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Here's a few places to check:

~/$ProjectName
/Users/$HomeDir/$ProjectName (same dir as above, just the full structure)
/Developer/$ProjectName

Within XCode, you can press Apple+I and it will show where its at.
e.g "Path: /Users/$HomeDir/Projects/$ProjectName"

thanks, but i mean inside xcode. i thought that it would be there, but it's not. i only see a .xml file, and some folders, but no .java file

did i do something wrong? i just chose a Java application when i created a new project
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
No problem... you've created the project, but no file.

When you're looking at the project window, right click on the project (should be the top thing under "Groups and Files" on the left) and select Add->New File...->Pure Java->Java Class.
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
No problem... you've created the project, but no file.

When you're looking at the project window, right click on the project (should be the top thing under "Groups and Files" on the left) and select Add->New File...->Pure Java->Java Class.

oh ok. i thought it was something like that. i'm used to other languages, where xcode makes though files automatically
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
oh ok. i thought it was something like that. i'm used to other languages, where xcode makes though files automatically
The thing is, there's no automatic file it could make, unless you'd be willing to assume that a "MySampleProject" project would always want "MySampleProject.java", which is possibly useful for school projects, but which a professional would rarely want.
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
The thing is, there's no automatic file it could make, unless you'd be willing to assume that a "MySampleProject" project would always want "MySampleProject.java", which is possibly useful for school projects, but which a professional would rarely want.

oh ok. well, java is still very new to me (first day of class). hopefully i'll learn more very soon

thanks :)
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
ok, so i'm having a little trouble. i made a new project - a java application. did i want java applet?

i added the java class file to it. but all i want is a simple command line program. what i have doesn't print anything.
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
No, you didn't want a java applet, unless you will be embedding it into a web page.

You probably wanted a Java Tool. With a Tool, it does build a .java file template for you with a "Hello World!" println.

Todd
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
No, you didn't want a java applet, unless you will be embedding it into a web page.

You probably wanted a Java Tool. With a Tool, it does build a .java file template for you with a "Hello World!" println.

Todd

thanks, i'll try that next time.

i ended up just using terminal to compile and run the program. i made a 100! :D
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
WOO-HOO!!! Good for you. What was the assignment?

thanks. it wasn't hard. 3 very simple programs:

1. make a program that flips a coin 10 times and displays heads or tails
2. change program #1 to ask the user how many times to flip the coin
3. put 100 random numbers in an array. print the sum of the square roots of the values.

so it was pretty easy. but i know they'll get harder
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
so for my class, we will be creating java servlets. in windows, they use tomcat. what do i use for mac and with xcode? or can i do this?
 

4409723

Suspended
Jun 22, 2001
2,221
0
so for my class, we will be creating java servlets. in windows, they use tomcat. what do i use for mac and with xcode? or can i do this?

Tomcat works on Mac OS also. When I worked with JSP I used used a text editor like TextWrangler and the terminal.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
twoodcc, thanks for demonstrating why an IDE may not make sense when getting started with Java and congrats on your 100. If you really wanted to try an IDE again later that shouldn't get in the way, do check out Netbeans BlueJ edition.

Also, you can use a variety of app servers such as tomcat, jetty, glassfish and others...All work just as well on the Mac. I'd suggest tomcat since that's what the instructor is using.
 

Monkaaay

macrumors 6502
Jun 19, 2006
258
0
Richmond, VA
twoodcc, thanks for demonstrating why an IDE may not make sense when getting started with Java

Just because he doesn't understand the concept of an IDE before it ever being explained to him doesn't make your statement correct. Spend 5 minutes, explain the differences of these tools, and he'll be off on his merry way with more knowledge.
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Tomcat works on Mac OS also. When I worked with JSP I used used a text editor like TextWrangler and the terminal.

thanks, i'm working on installing tomcat now. a little more complex than i thought

twoodcc, thanks for demonstrating why an IDE may not make sense when getting started with Java and congrats on your 100. If you really wanted to try an IDE again later that shouldn't get in the way, do check out Netbeans BlueJ edition.

Also, you can use a variety of app servers such as tomcat, jetty, glassfish and others...All work just as well on the Mac. I'd suggest tomcat since that's what the instructor is using.

thanks, i actually made 100 last week, and the instructor asked me to present it to the class! again, it was still just a simple program.

yeah, i'll go with tomcat since my team members have that as well. i also have to think about what type of database to use. mysql?
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Again, lots of choice here. I suggest you use what your instructor encourages. You can use Mysql no problem.

well, he said you could any you wanted to, but recommended access. which i can't do i mac os x, right?

also, i'm having trouble installing tomcat. i was trying to go by apple's pdf, but for some reason it didn't work
 

osxfactor

macrumors newbie
Feb 8, 2008
6
0
Java, Mac OS X, and IDEs

Congrats on the good score. I'm taking a couple of Java classes now myself (just finishing up the first one).

A few things to note when developing Java apps on Mac OS X.

1) XCode is nice, but Eclipse is a much better Java IDE (although I feel that Xcode is a much better IDE overall). Especially for a newbie like you and me, Eclipse is always compiling and evaluating code, and it will let you know immediately when you've made a mistake, which is much better than writing 100 lines of code and finding your mistake after your run your app. TextMate makes a pretty nice code editor as well, but still, you don't get the instant code checking that Eclipse provides.

2) There are plenty of servlet engines for Mac OS X. Tomcat is the most popular. The installation is pretty painless. Download it, unzip it, place it in your apps folder, and then run the catalina.sh start script in the terminal. Boom. Check localhost:8080, and you should see the Tomcat splash screen. There is also JBoss, and now Glassfish as well.

3) Get comfortable with the command line. Compiling from the command line is easy once you know what you are doing. Most Java tools are written with UNIX/Linux in mind, so using the terminal will be a huge help to you down the road.

Good luck!
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Congrats on the good score. I'm taking a couple of Java classes now myself (just finishing up the first one).

A few things to note when developing Java apps on Mac OS X.

1) XCode is nice, but Eclipse is a much better Java IDE (although I feel that Xcode is a much better IDE overall). Especially for a newbie like you and me, Eclipse is always compiling and evaluating code, and it will let you know immediately when you've made a mistake, which is much better than writing 100 lines of code and finding your mistake after your run your app. TextMate makes a pretty nice code editor as well, but still, you don't get the instant code checking that Eclipse provides.

2) There are plenty of servlet engines for Mac OS X. Tomcat is the most popular. The installation is pretty painless. Download it, unzip it, place it in your apps folder, and then run the catalina.sh start script in the terminal. Boom. Check localhost:8080, and you should see the Tomcat splash screen. There is also JBoss, and now Glassfish as well.

3) Get comfortable with the command line. Compiling from the command line is easy once you know what you are doing. Most Java tools are written with UNIX/Linux in mind, so using the terminal will be a huge help to you down the road.

Good luck!

thanks for the nice post.

where can i download that tomcat? i did download one version, but i had to compile it myself somehow, and i couldn't do it right
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
thanks. how do i "set a env variable"?

First try to start tomcat without doing that. If it launches, you won't need to. If it complains that you should set JAVA_HOME, in terminal
Code:
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home

You can also add the above command to your .bashrc file located in your home folder. If you don't have that file, you can create it.
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
First try to start tomcat without doing that. If it launches, you won't need to. If it complains that you should set JAVA_HOME, in terminal
Code:
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home

You can also add the above command to your .bashrc file located in your home folder. If you don't have that file, you can create it.

well i'm still confused. i downloaded the zip, and unzipped it. now i have a folder with files in it, but nothing to launch/start tomcat (that i see).

i tried your command in terminal, but it said "setenv: command not found"

sorry i'm new to the command line
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.