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

Gilgi

macrumors newbie
Original poster
Aug 7, 2008
3
0
I'm trying to do some java programming in Xcode and cannot figure out how to take other java files and include them in the project so that i can use classes already written in previous java files. I tried everything I can think of including:

-Going through the menu bar and selecting (Project) -> (Add to Project) and then adding whatever java file I wanted.
-Manually adding java files into the src directory for the project
-Adding a seperate project file into the current project

How the heck do you add other java files to the project???
 
Are the files appearing in the source tree view? If they are but not being compiled then you just need to add them to the project's target.

b e n
 
The files are appearing in the source tree view. Though I have not added the file I want to to add as a target. I am having some trouble figuring out how to add to the project's targets.

I tried going to (Project) -> (New Target...) and this takes me to a GUI with a whole lot of options. Specifically, it wants me to choose a template (BSD, Carbon, Cocoa,.....) and then a type of target. I pretty new to all this so I do not know what to choose here. In fact I'm not even sure if this is how to add a file as a target.

This all seems overly complicated. Is there some sort of add file wizard in Xcode? Or could someone explain the easiest way to add a java file to the project from start to finish? Thanks for any help.
 
Okay. If your src folder in the project tree view is blue, then it will reference a real directory in your project directory. All you need to do is move your Java files into that directory or a sub-directory (you need to create subdirectories to reflect the package layout of your files).

b e n
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.