Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 1, 2009, 03:35 PM   #1
Koreos
macrumors member
 
Join Date: Mar 2008
Java & C++ in Xcode - Question

I know it isn't practical to use Xcode for Java & C++, but I only need it to get by for the school projects (silly, one-file classes). And I would like to avoid having to install different IDEs.

My question is, how do I use Xcode without a project? (using it with a single .java or .cpp file)
I've tried opening the .java file, but all the build, run, debug, etc options are greyed out.

Thank you.
Koreos is offline   0 Reply With Quote
Old Feb 1, 2009, 03:55 PM   #2
toddburch
macrumors 6502a
 
Join Date: Dec 2006
Location: Katy, Texas
Send a message via AIM to toddburch Send a message via MSN to toddburch
The short answer to your question is you don't use Xcode without a project. Create the project sets everything up for compiling and linking and builds.

I created a Java Application project in Xcode the other day, just to see what I would get, and I was very surprised to find tons of crap I did not need.

So, I went back to using an editor (I use TextWrangler) and the command line in Terminal. It works. However, I've gotten myself spoiled on Windows using Eclipse for the last couple weeks. It's like having your own little teaching assistant inside the computer, help you along and pointing out everything you need to know as you go.

I use XCode a lot for C++ projects. It's an all-in-one stop for doc, editing, code completion and interactive debugging.
toddburch is offline   0 Reply With Quote
Old Feb 1, 2009, 04:00 PM   #3
plinden
macrumors 68040
 
plinden's Avatar
 
Join Date: Apr 2004
Eclipse is also available for the Mac. I also like NetBeans, but I use Eclipse more. Both add a few project-specific files, but nothing that prevents you from using the command line to build and run.

If you use an IDE for Java development, try to spend as much time looking at the file structure of the source code and compiled classes as you do in the IDE itself, so you'll learn about Java itself.
plinden is offline   0 Reply With Quote
Old Feb 1, 2009, 06:31 PM   #4
eddietr
macrumors 6502a
 
Join Date: Oct 2006
Location: Virginia
If you create a new project using the java command line utility project template, you end up with a pretty clean and useful structure for small learning/teaching exercises.

And you get a basic ant build script that you can also use from the command line.
eddietr is offline   0 Reply With Quote
Old Feb 1, 2009, 07:13 PM   #5
lazydog
macrumors 6502a
 
Join Date: Sep 2005
Location: Cramlington, UK
Send a message via MSN to lazydog
Hi

Xcode is great for C++ and Java (so long as you don't expect a graphical ui builder). For Java it may not have all the bells and whistles as Eclipse or Netbeans but in my opinion it does have a simpler and cleaner interface.

b e n
lazydog is offline   0 Reply With Quote
Old Feb 2, 2009, 06:33 PM   #6
Cdub16
macrumors member
 
Join Date: May 2008
Eclipse better for Java

I write a lot of Java and i just think Eclipse is much easier to use. Eclipse is great and much faster to write code with for JAVA, not objective c. Don't know much about C++. Ive also heard NetBeans is great.
Cdub16 is offline   0 Reply With Quote
Old Feb 4, 2009, 10:20 AM   #7
minijon
macrumors member
 
Join Date: Feb 2008
Location: St. Louis, MO
Send a message via AIM to minijon
I find that neither solution is perfect. I use Xcode in the single document per window mode and really like that - its easy to pull information from multiple sources that way.

Eclipse has that one-giant-window school of thought. It's probably less confusing if it's for school projects with a console based main() and a few supporting classes.

The way it reports build errors also seems less confusing.

But because in addition to the crap I'm doing for school, I'm working on iPhone stuff, I find I'm using Xcode for java just because I like the overall interface better.
__________________
MacBook Pro, 2.4Ghz (Penryn), 2GB RAM, 250GB/5400RPM HDD, Windows 7 (VM), and Vista x64 (BC)
iPod Nano, 2G, 4GB
minijon is offline   0 Reply With Quote
Old Feb 4, 2009, 04:17 PM   #8
Koreos
Thread Starter
macrumors member
 
Join Date: Mar 2008
Quote:
Originally Posted by minijon View Post
I find that neither solution is perfect. I use Xcode in the single document per window mode and really like that - its easy to pull information from multiple sources that way.

Eclipse has that one-giant-window school of thought. It's probably less confusing if it's for school projects with a console based main() and a few supporting classes.

The way it reports build errors also seems less confusing.

But because in addition to the crap I'm doing for school, I'm working on iPhone stuff, I find I'm using Xcode for java just because I like the overall interface better.
But how do you get Xcode to build, run/debug a single file of java? it's all greyed out for me.
Koreos is offline   0 Reply With Quote
Old Feb 4, 2009, 04:37 PM   #9
toddburch
macrumors 6502a
 
Join Date: Dec 2006
Location: Katy, Texas
Send a message via AIM to toddburch Send a message via MSN to toddburch
You have to go to File -> New Project and pick any of the Java templates.
toddburch is offline   0 Reply With Quote
Old Feb 4, 2009, 04:43 PM   #10
Dale Cooper
macrumors regular
 
Join Date: Sep 2005
Quote:
Originally Posted by Koreos View Post
silly, one-file classes
As mentioned, sounds like it would be much less of a hassle to download some plain text editor like Smultron or TextWrangler than messing around with xcode projects...
__________________
Bob
Dale Cooper is offline   0 Reply With Quote
Old Feb 4, 2009, 05:40 PM   #11
moniker
macrumors member
 
Join Date: Jun 2007
Location: London, UK
Quote:
Originally Posted by Koreos View Post
But how do you get Xcode to build, run/debug a single file of java? it's all greyed out for me.
You create a new Java project in Xcode, then add that single Java file to the project. Xcode requires a project in order to know how to build and run. Just like most other IDE's.
moniker is offline   0 Reply With Quote
Old Feb 5, 2009, 10:07 AM   #12
minijon
macrumors member
 
Join Date: Feb 2008
Location: St. Louis, MO
Send a message via AIM to minijon
Yeah, you've got to start a project. Use the Java Tool thing for the console stuff you start out with. Then to run (and use the console) you have to actually pull up the console window under the Run menu.
__________________
MacBook Pro, 2.4Ghz (Penryn), 2GB RAM, 250GB/5400RPM HDD, Windows 7 (VM), and Vista x64 (BC)
iPod Nano, 2G, 4GB
minijon is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Xcode and java??? falconb Mac Programming 10 May 15, 2014 01:17 AM
Safari 7 & Java ngaham OS X Mavericks (10.9) 9 Nov 28, 2013 01:26 AM
Command line tools & Xcode 5 & Mavericks ka-spot OS X Mavericks (10.9) 1 Oct 24, 2013 10:35 AM
XCode 5 DP and Java Problem aquethys Mac Programming 0 Aug 28, 2013 10:59 PM
Chrome on OS X -- Java plugin / Java 7 vs Java 6 Issue booyahbooyah Mac Applications and Mac App Store 4 May 31, 2013 10:13 AM

Forum Jump

All times are GMT -5. The time now is 12:58 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC