Adding files in Java Xcode Project

Discussion in 'Mac Programming' started by Gilgi, Aug 7, 2008.

  1. Gilgi macrumors newbie

    Joined:
    Aug 7, 2008
    #1
    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???
     
  2. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #2
    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
     
  3. Gilgi thread starter macrumors newbie

    Joined:
    Aug 7, 2008
    #3
    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.
     
  4. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
  5. Gilgi thread starter macrumors newbie

    Joined:
    Aug 7, 2008
  6. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #6
    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
     

Share This Page