Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > New to xcode

New to xcode
Thread Tools
Dedicated MacNNer
Join Date: May 2005
Status: Offline
Reply With Quote
Dec 15, 2005, 12:37 AM
 
I installed xcode to write java apps, but when i want to compile them, the build menu is all grayed out. Any suggestions?
PB12 / 1.5 / 80 / 1.25 / SD
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Dec 15, 2005, 12:51 AM
 
Originally Posted by warra
I installed xcode to write java apps, but when i want to compile them, the build menu is all grayed out. Any suggestions?
You realize that Xcode can only compile projects, not individual files, right? (That is, even if there's only one file you want to compile, it has to be in a project, because that is where Xcode stores its build settings.)
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
warra  (op)
Dedicated MacNNer
Join Date: May 2005
Status: Offline
Reply With Quote
Dec 15, 2005, 01:13 AM
 
no, i didn't know that. How would I go about just compiling one file? Told you I was new to xcode...
PB12 / 1.5 / 80 / 1.25 / SD
     
Mac Elite
Join Date: Sep 2005
Location: Vancouver, BC
Status: Offline
Reply With Quote
Dec 15, 2005, 01:22 AM
 
You might be able to just use the command-line Java compiler -- javac.
     
Grizzled Veteran
Join Date: May 2005
Location: Toronto, ON
Status: Offline
Reply With Quote
Dec 15, 2005, 08:39 AM
 
I'm not really sure on any of this b/c although I have xcode installed, I haven't had the time to sit down and learn to use it.

But you might find more help in the developer's center forum
http://forums.macnn.com/developer-center/

hope that at least gives you a starting point. Good luck.
MacBook Pro | 2.16 ghz core2duo | 2gb ram | superdrive | airport extreme
iBook G4 | 1.2ghz | 768mb ram | combodrive | airport extreme
iPhone 3GS | 32 GB | Jailbreak, or no Jailbreak
     
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status: Offline
Reply With Quote
Dec 15, 2005, 10:02 AM
 
to compile one file, you will need to create a project in xcode and then have your file listed there to be built.

tomchu has the right idea if you would rather not create a project: write up the code in xcode (for the nice color coding and help strings) and then use javac from terminal (not sure what all the arguments would be, but it will create the files for you) for the compile/build....and checking the developer's forum is also always a good thing too.
some people are like slinkys: they don't do much, but are fun to push down stairs.
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Dec 15, 2005, 12:20 PM
 
Like people are saying, either just use [font=Courier New]javac[/font] from the command line, or make a project in Xcode. The proper project template is "Java tool" or something like that.
     
warra  (op)
Dedicated MacNNer
Join Date: May 2005
Status: Offline
Reply With Quote
Dec 15, 2005, 11:43 PM
 
I tried using Java Tool, then created a new file (a very simple java program), but it said it it failed whil trying to build.
PB12 / 1.5 / 80 / 1.25 / SD
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Dec 15, 2005, 11:50 PM
 
Don't create a new file. Edit the projectname.java file that is automatically created for you.
     
Mac Elite
Join Date: Oct 2004
Location: Downtown Austin, TX
Status: Offline
Reply With Quote
Dec 16, 2005, 12:53 AM
 
If you're just making simple (less than 10 files) Java programs, forget XCode. I'd download jEdit or TextWrangler and use one of those to edit your files and then open up a Terminal and type:

"javac YourJavaFile.java"

to compile, and then do

"java YourJavaFile"

to run.

javac will generate your .class file, but when you specify the class file to java command you have to leave off the .class extension, otherwise you'll get a class not found error.

For example, if your source file is named TheAwesome.java, you would type

"javac TheAwesome.java"

to compile, and then

"java TheAwesome"

to run it.
     
warra  (op)
Dedicated MacNNer
Join Date: May 2005
Status: Offline
Reply With Quote
Dec 16, 2005, 11:14 AM
 
excellent, thanks everyone.
PB12 / 1.5 / 80 / 1.25 / SD
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:37 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2