so, i'm taking a java class. i created a new java application project in xcode 3, but where if the .java file?
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"
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.
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. 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.
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
i made a 100!
WOO-HOO!!! Good for you. What was the assignment?
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?
twoodcc, thanks for demonstrating why an IDE may not make sense when getting started with Java
Tomcat works on Mac OS also. When I worked with JSP I used used a text editor like TextWrangler and the terminal.
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.
i also have to think about what type of database to use. mysql?
Again, lots of choice here. I suggest you use what your instructor encourages. You can use Mysql no problem.
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
No compiling should be necessary. Just unzip, set a env variable, and be on your way
http://mirror.olnevhost.net/pub/apache/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip
thanks. how do i "set a env variable"?
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home
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.