XCode Java project: can't add files

Greetings all,
I have a Java codebase which I developed in JBuilder. I now want to produce the final product, a Mac app. To do this I fired up my XCode 2.5. I went File->New Project and chose Java Application under the Java template group.
Since I don't want the three .java files that the template helpfully puts into the project, I removed them. (The only way to do this seems to be to close the project, go to the Finder, and delete them there, then re-open the project...whatever...) My next task was obviously to add my java files and the three .jar files that they depend on.
Which is where I ran into problems. It doesn't seem to matter what I do, I cannot get my files properly added to the project.
I have tried dragging the files from the Finder into the XCode project window and dropping them on the src group icon; despite the fact that the disclosure triangle to the left of the group flashes a lovely shade of pink and then self-opens, when I drop the files there, they do NOT get put into the group; they become siblings of the group instead.
I have tried right-clicking on the group and choosing Add->Existing Files; same result as above.
I have tried single-clicking on the group and choosing Project->Add to Project from the menu bar; same result as above.
I should mention that in all of these three, I do get asked whether I want to copy the file or just have a reference created to it; I always choose not to copy the file (since I want my files to live elsewhere). However, just to experiment, I have just tried Project->Add to Project and asked for the chosen file to be copied...same result as above. The file ends up a sibling of the src group.
I have also tried removing the src group from the project window and then dragging in from the Finder the entire src folder which holds my Java codebase. It successfully arrives in the project window, but its colour is yellow (whereas the original one's colour was blue) and it never gets compiled. I can't seem to convince XCode that these files are source and should be compiled...despite the fact that if I get out the Info window on any of them, the FileType popup menu states that they are "sourcecode.java".
I have even tried making an alias to the src folder which holds the codebase, and moving this alias into the XCode project directory in the Finder. This fails to build since XCode tells me that it can't create the directory "src" since one already exists with that name!
The only way I have found which has any success at all is to actually copy the files and folders into the src and lib folders of the XCode project directory, in the Finder. However, this is not acceptable for either the java or the .jar files. The java files need to be in a certain location for JBuilder, and the .jar files are common files and I am not at all interested in having multiple copies of them floating around on my disk! Furthermore this sort of behaviour should not be necessary with a modern compilation system, especially not one created by Apple.
Please, can some kind soul tell me, how on earth am I supposed to add existing files to an XCode Java application project, without putting them into the project directory on the disk?
Thanks gratefully in advance!

Hi SkiAddict1
I can't speak for Xcode 2.5, only 3.1...
The way to add new Java source files is to highlight one of the existing source files (in the src group) and then use File > New File...
If you want to create a package hierarchy, then you need to use Finder to create the corresponding folders inside src. Once you've done this, then you can create a source file inside a package by highlighting any Java source file, then selecting File > New File... then using the Choose option to specify the correct location. At this point, the main project window doesn't show the newly created file in the folder hierarchy, however next time you restart Xcode it will appear in the right place.
I think the issue is that the designers of Xcode didn't adequately cater for the Ant tool's use of a src folder and the requirement for nested folders to represent a package hierarchy. However, it's still possible to make do provided you create the folders yourself and always remember to highlight an existing source file before creating a new file.
Bob
PS: A neat trick which I find quite handy when porting an existing Java program is to use the boilerplate main class which Xcode creates and use it to call the main () method of the imported project. Eg:
public class ProjectName {
public static void main (String [] args) {
// Call the main method of the imported project
com.company.project.ProjectClass.main (args);
}

Similar Messages

  • XCode Java project - can you compile both a Mac .app and a Windows .exe?

    I'm working on a project for my computer science class, and it has to be done in Java. I'd like to be able to build a .app for the Mac and a .exe for Windows, and ideally I'd like to do it straight from within XCode. Is it somehow (at all) possible to configure a target to compile a .exe, or is there an easy way to export an XCode project so it can be easily opened on some Windows application and compiled into a .exe? (note: I am TOTALLY clueless about .exe files and how they're compiled!)

    In theory, you can simple stuff everything into a JAR file, and run that
    directly on the Windows box. The user simply double-clicks the JAR
    file. But it is better, for various reasons, to hide the JAR file inside an
    EXE. There are several packages that will do that for you. I think that
    "Launch4J" is a good choice. It is free, and well supported.
    Here is a good survey article, with links to many of the choices.
    http://www.excelsior-usa.com/articles/java-to-exe.html

  • Can't add files filmed in 1080/60i to Premiere Elements 12. I have no problem to add  files filmed in 1080/30p. My camera is a Nikon aw1

    Can't add files filmed in 1080/60i to Premiere Elements 12. I have no problem to add  files filmed in 1080/30p. My camera is a Nikon aw1

    lurkfan
    What computer operating system is your Premiere Elements 12 running on? Have you updated 12 to 12.1 Update using an opened project's Help Menu/Update?
    If not, please do so.
    Please clarify  "Can't add files filmed in 1080/60i to Premiere Elements 12."
    Are you importing the 1080 60i into the project using (Expert workspace) Add Media/Files and Folders/Project Assets?
    If so, are you getting an error message inside of the video appearing in Project Assets?
    Are you setting the project preset manually or letting the program do that task automatically?
    What is the project preset?
    (See Edit Menu/Project Settings/General).
    The project preset should be, for your 1080i...
    NTSC
    AVCHD
    Full HD1080i30
    What is the project preset for the 1080p footage?
    (Also see Edit Menu/Project Settings/General.)
    The project preset should be, for your 1080p
    NTSC
    DSLR
    1080p
    DLSR 1080p30 or DLSR [email protected]
    Since your camera appears to be producing AVCHD.mov files, do you have the latest version
    of QuickTime installed on your computer with Premiere Elements 12/12.1?
    The answers will be in the details. Please review and then let us know the details and results
    based on the above.
    Thank you.
    ATR

  • Tfs - user can't add files

    hi!
    i have the following problem:
    my team consists of two members with (seemingly) equal project permissions.
    however, only one of the two can add new files to the project. (compare folders, "add file" is greyed out for user a but works for user b)
    i compared the security settings for both users in the tfs admin console, but couldn't find any difference.
    where is the switch i'm looking for?
    any help would be appreciated.
    thanks!

    Hi Haklinz,  
    Thanks for your post.
    What’s the version of your TFS and VS?
    Do you mean that if user a compare the same two folders(which user b compared) in VS Source Control Explore, the
    Add Files button is greyed for user a in Folder Difference
    window, but if user b compare the same two folders, he can click the Add Files button inFolder Difference
    window?
    I tested this scenario on my client and found that: the Add Files button only available in
    Folder Difference window, when user selected the local item(folder/file) which not stored in TFS Source Control in
    Folder Difference window, please ensure the user a selected the right local item in
    Folder Difference window.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can't add files or file aliases to the dock

    I can't add files or file aliases to the dock. All the help viewer says about this is this issue?
    "If you can't add icons to your Dock, your administrator may be preventing you from doing so."
    I am the administrator of this computer, as it turns out. What is the solution to

    Hi Wagnerian, Welcome to Apple Discusswions.
    When adding files or folders to the Dock, they must go to the right side of the hairline (the same side that Trash is on).
    If this what you are doing and it still doesn't work navigate to /Users/YourHome/Library/Preferences/com.apple.dock.plist and delete that file. then log out and back in or restart. (You'll have to reset your Dock the way you like it)
    -mj
    [email protected]

  • Hello Sorry for the inconvenience, but I have a problem in Java I can not open files, audio chat, which type of jnlp after the last update of the Java 2012-004 Please help me in solving this problem.

    Hello Sorry for the inconvenience, but I have a problem in Java I can not open files, audio chat, which type of jnlp after the last update of the Java 2012-004
    Please help me in solving this problem. 

    Make sure Java is enable in your browser's security settings.
    Open Java Preferences (in Utilities folder)
    Make sure Web-start applications are enabled.
    Drag Java 32-bit to the top of the list.
    jnlp isn't an audio file format. It's just a java web-start program (Java Network Launching Protocol).

  • Why java only can display GIF file not jpeg and BMP ??

    Did anyone know why java only can display GIF file not in jpeg and BMP ?? This is because the quality of GIS is not as good as Jpeg and BMP
    any code to load the display process ??
    thx guys !!!

    you can do jpegs but im not sure about bmps.
    The only thing ive noticed is that java cant support transparent jpegs, only transparent gifs
    Jim

  • Can't add file to baggage files folder

    Hi,
    I have a javascript file I'm trying to add to the baggage
    files folder. However, for some reason, I can't add it. I'm using
    robohelp 6 and roboosource control 3.0. When I try to add the file,
    nothing is added to the folder. I was able to add the same JS file
    to another project that was created in X5. So I'm unsure what the
    prolem is.
    I manually added the javascript file to the rhbag.apj file
    but it still doesn't seem to recognize that this file is added to
    the baggage files folder or project. I'm still getting a javascript
    error as if the file is not in the project.
    Strangely enough, when I tried to add the javascript file
    from the other project's folder, it asked me if I wanted to
    overwrite the js file. But it still doesn't appear in the baggage
    files folder or in source control.
    Any help is appreciated.
    thanks
    --Brad

    Hi Rick
    Sorry--I guess my previous response wasn’t clear. I did
    physically copy the JS file to the local project folder first. I
    didn’t think it would magically appear.
    In terms of the .apj file, I edited it—adding
    the code for the script from another project’s apj where the
    same script is working—and saved it. But it’s still not
    adding the js file to the baggage files folder or to source
    control. When I view the apj file that’s in source control,
    it has the js code in there.
    I then tried overwriting the apj with the apj from a project
    where the script is working (that’s what I meant by
    replacing), but that didn’t work either. To add another
    twist, the script runs without errors in preview mode, but not in
    the compiled html help.
    I’m unsure what’s wrong with this project as this
    script is successfully working in other projects and visibly
    appears in the other projects’ baggage files folders. I hope
    this was a little clearer.
    I’m open to any other suggestions.
    Any questions, let me know.
    Thanks
    Brad

  • Can't add files to library

    I can load music off of cds into my library, but other music files that i have on my computer will not load. The little window comes up saying "loading files" and then it stops halfway through, and nothing is loaded - what is happening?

    Yes I would like to know the same thing.I am trying to import or add files (home videos) to my itunes movie library and I followed the directions and nothing happens.
    How the heck do you import or add videos from my camera that I've downloaded onto my computer and then want to add it to my Ipod through itunes library and it will not import ito the library.I ready to throw a brick through this thing!!!!Any help out there????

  • How can I add file attachment to my form and get the attachment by email?

    I'm using this code and it works fine, but I don't get the attachment file in the email. How can I add this to my code?
    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">// <![CDATA[
                  $(document).ready(function() {
                    $("#form1").validate({
                      rules: {
                        first: "required",// simple rule, converted to {required:true}
                        email: {// compound rule
                        required: true,
                        email: true
                      last: {
                        last: true
                      comment: {
                        required: true
                      messages: {
                        comment: "Please enter a comment."
    // ]]></script>
    <script type="text/javascript">// <![CDATA[
    function validate ()
              if (document.form1.first.value == "")
              alert("Please enter your First Name");
              document.form1.first.focus();
              document.form1.first.style.border="1px solid red";
              return false;
              else if (document.form1.last.value == "")
              alert("Please enter your Last Name");
              document.form1.last.focus();
              document.form1.last.style.border="1px solid red";
              return false;
              else if (document.form1.emailaddress.value == "")
              alert("Please enter your Email Address");
              document.form1.emailaddress.focus();
              document.form1.emailaddress.style.border="1px solid red";
              return false;
    function has_focus() {
        if(document.form1.first.value == "")
                                  document.form1.first.focus();
                                  document.form1.style.first.border="1px solid green";
    function set_focus(x)
              document.getElementById(x).style.border="1px solid #80CA75";
    function clear_focus(x)
              document.getElementById(x).style.border="1px solid #DBDFE6";
    // ]]></script>
    </head>
    <body>
    <p><span style="color: #666666; text-align: center; font-size: 13px;">Please complete this form if you have any technical issue.</span></p>
    <form id="form1" action="http://www.southsun.com/php/tech_issue.php" enctype="multipart/form-data" method="post">
    <table style="width: 850px; font-size: 15px; padding-left: 20px; text-align: center;" border="0">
    <tbody>
    <tr>
    <td style="text-align: left; padding-bottom: 20px;" colspan="2">
    <h2><span style="color: #666666;">Please complete this form if you have any technical issue.</span></h2>
    </td>
    </tr>
    <tr style="padding-top: 40px;">
    <td style="text-align: left;"><span style="color: #abaf6f;"><strong>First Name</strong>:*</span><input id="first1" name="first" type="text" />  <br /><br /> <span style="color: #abaf6f;"><strong>Last Name</strong>:*</span><input id="last1" name="last" type="text" /><br /><br /> <span style="color: #abaf6f; padding-right: 33px;"><strong>Email</strong>:</span><span style="color: #abaf6f;">*</span><input id="email1" name="email" type="text" /><br /><br /> <span style="color: #abaf6f;"><strong>Shipping Method:</strong><br /></span> <input name="shippingmethod" type="radio" value="prioritymail" /> Priority Mail                                                                 <input name="shippingmethod" type="radio" value="store" /> In Store Pick up <br /> <input name="shippingmethod" type="radio" value="ground" />  Ground                                                                       <input name="shippingmethod" type="radio" value="3day" /> 3 Day Select<br /><br /> <span style="color: #abaf6f;"><strong>Payment Method:</strong><br /></span> <input name="paymentmethod" type="radio" value="paypal" /> Paypal Method                                                       <input name="paymentmethod" type="radio" value="creditcard" /> Credit Card<br /> <strong><br /> <span style="color: #abaf6f;">If getting an error message, please explain the error:</span></strong><span style="color: #abaf6f;"> <br /></span> <textarea id="errormessage" cols="20" rows="2" name="errormessage"></textarea><br /><br /></td>
    <td style="border-left: 1px solid grey; padding-left: 40px; text-align: left;"><span style="color: #abaf6f;"><strong>If using Paypal, Were you redirected successfully?</strong><br /></span> <input name="paypalredirect" type="radio" value="yes" /> Yes                                                                 <input name="paypalredirect" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>If using Credit Card, Did you get an error?</strong><br /></span> <input name="carderror" type="radio" value="yes" /> Yes                                                                  <input name="carderror" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>What happened after clicking place order? </strong><br /></span> <textarea id="placeorder1" cols="20" rows="2" name="placeorder"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Comments</strong>: <br /></span> <textarea id="comments1" cols="20" rows="2" name="strcomments"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Attach PrintScreen</strong>: <br /></span> <input name="strresume" type="file" />
    <div style="height: 50px;"> </div>
    </td>
    </tr>
    <tr>
    <td style="padding-top: 20px;" colspan="2">( * ) indicates required fields</td>
    </tr>
    <tr>
    <td style="text-align: center; padding-top: 20px;" colspan="2"><input class="button" name="submit" type="submit" value="Submit" />                        <input class="button" name="reset" type="reset" value="Reset" /></td>
    </tr>
    </tbody>
    </table>
    </form>
    </body></html>
    PHP
    <?php
    echo $savestring;
    //--------------------------paramaters--------------------------
    // Subject of email sent to you.
    $subject = 'prueba con uploads';
    // Your email address. This is where the form information will be sent.
    $emailadd = '[email protected]';
    // Where to redirect after form is processed.
    $url = 'http://www.pch-graphicdesign.com';
    // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
    $req = '0';
    $target_path = "http://www.pch-graphicdesign.com/php/uploads/";
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
    $text = "Results from form:\n\n";
    $space = ' ';
    $line = '
    foreach ($_POST as $key => $value)
    if ($req == '1')
    if ($value == '')
    {echo "$key is empty";die;}
    $j = strlen($key);
    if ($j >= 20)
    {echo "Name of form element $key cannot be longer than 20 characters";die;}
    $j = 20 - $j;
    for ($i = 1; $i <= $j; $i++)
    {$space .= ' ';}
    $value = str_replace('\n', "$line", $value);
    $conc = "{$key}:$space{$value}$line";
    $text .= $conc;
    $space = ' ';
    mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>

    Sending a file as an attachment to an email involves setting the correct MIME type and headers. There's a brief tutorial here: http://webcheatsheet.com/php/send_email_text_html_attachment.php.
    Also, you need to use the same name as in your form. In the script you have shown here, the name of the file field is strresume, but your processing script uses this: $_FILES['uploadedfile']['name']. It should be this: $_FILES['strresume']['name']

  • How can i "add file to library" and have it be considered to be a Podcast?

    I went to a web site and downloaded a file to my C drive (MP3 format) that is not music. It is spoken, and is what i would call a 'Podcast', although i did not access it via iTunes as an official podcast. I then use iTunes "add file to library" function. But, it considers it to be music. I thought maybe drag/drop would work to let me add it to Podcasts, but it does not.
    How can i get this file which i have imported into iTunes to be treated as a Podcast? First, i'd like it to appear on my iPod with 'Podcasts'. But, more importantly, if i stop listening in the middle, i'd like it to restart from that point the next time i start it again. Now, it is treated by the iPod like music, and so it starts at the beginning each time.
    Thanks for your help! Tom.
      Windows XP  

    Is there a way that you can "subscribe" to something that is not in iTunes store? This is just a file on a site that is available for download.
    If not -- does anybody else know if there is a way to do what the original question posed, to have a file that you downloaded, treated as a Podcast instead of as music?
    Thanks, tom.
    Windows XP

  • Can't add files to two different phones

    I have created a ringtone for my iphone 4s and loaded just fine.  I tried to add the ringtone to my fiances phone and I get the red circle with the line through it so I can't add anything to her phone.  No photos, music etc.  I tried signing out of Itunes and into her account but still nothing.  Computer is authorized.  Ringtone is in the Tones folder in ITunes but just can't drag and drop in hers but can in my Iphone 4s.  Any suggestions?

    I think your method is wrong.  You should not change the m4a file to m4r file in it's original location which is for music library.
    Refer proper steps here for creating ringtones:
    Before you start, first go to iTunes top menu, click "Edit", "Preference". Under "general" Tab, click "Import Settings", make sure under Import Using that "AAC Encoder" is selected.
    Right click the song in music library you want to create ringtone and choose “Get Info” 
    Choose “Option” Tab, Check “Start Time” & Stop Time” of the track you want to make into ringtone and put in your start time and end time (Max 40 secs duration), then click OK 
    Right mouse click the music again and choose “Create AAC Version” 
    You will see a copy of song with same name appeared but with 40sec duration only. Now drag the song onto your desktop and you will see the name is now xxxxxx.m4a. 
    Change the file extension m4a into m4r from the desktop 
    Delete the 40sec m4a file from the music library (You must do this step or Itune will not accept your new m4r file). 
    *Important - Now uncheck the start & stop time of the original song so that you can play back full length. 
    Now, drag the m4r file from desktop to Library 
    Click onto the Tones under Library, and you find you ringone file.
    Once you have the ringtones in Tones library, you may sync it to your device. Connect and select your iPhone on iTunes left Pane, then on right go to Tones tab and make sure SYNC Tones is checked and click the APPLY or SYNC button on the lower right window.

  • Can´t add files to Mediathek? Limit at 24950???

    Hello,
    I can´t add Songs to the Library. The is no Message or error, I can rip CDs and they will be copied as MP3 into the regular Folders on the computer, but they won´t be added to the library.
    I have all rights for the Songs, and there is enough Space (33 GB). The library ist 130GB.
    Any suggestions`?

    I think your method is wrong.  You should not change the m4a file to m4r file in it's original location which is for music library.
    Refer proper steps here for creating ringtones:
    Before you start, first go to iTunes top menu, click "Edit", "Preference". Under "general" Tab, click "Import Settings", make sure under Import Using that "AAC Encoder" is selected.
    Right click the song in music library you want to create ringtone and choose “Get Info” 
    Choose “Option” Tab, Check “Start Time” & Stop Time” of the track you want to make into ringtone and put in your start time and end time (Max 40 secs duration), then click OK 
    Right mouse click the music again and choose “Create AAC Version” 
    You will see a copy of song with same name appeared but with 40sec duration only. Now drag the song onto your desktop and you will see the name is now xxxxxx.m4a. 
    Change the file extension m4a into m4r from the desktop 
    Delete the 40sec m4a file from the music library (You must do this step or Itune will not accept your new m4r file). 
    *Important - Now uncheck the start & stop time of the original song so that you can play back full length. 
    Now, drag the m4r file from desktop to Library 
    Click onto the Tones under Library, and you find you ringone file.
    Once you have the ringtones in Tones library, you may sync it to your device. Connect and select your iPhone on iTunes left Pane, then on right go to Tones tab and make sure SYNC Tones is checked and click the APPLY or SYNC button on the lower right window.

  • Can't Add Files To RW DVD

    Hello,
    I'm a musician and successfully backed up a Pro Tools session with no Problems to a -RW DVD. I tried to back up a second session and got an error messege stating I couldn't not add to the DVD. From Apples Help Menu I learned the only way I could add the other session was to erase the DVD and burn both session at the same time. This is unexceptable for obvious reasons. Is there a work around? Do I have to backup each session on it's own DVD? This is a serious design flaw in my opinion. I thought RW media was designed so you could add data to your disc when needed. What's up with that?
    Mac G4 Dual   Mac OS X (10.4.1)  
    Mac G4 Dual   Mac OS X (10.4.1)  
    Mac G4 Dual   Mac OS X (10.4.1)  

    There is no defined standard for a multiple-session DVD. Therefore to add files to a RW-DVD you must erase it first.
    I thought RW media was designed so you could add data to your disc when needed. What's up with that?
    No, RW media is designed so that you can erase it and reuse it.
    You can create multiple sessions CDs with CD-Rs you don't need CD-RWs. The RW has nothing to do with the ability to write multiple sessions.

  • Can't Add Files to iPod

    I just got a 20 GB iPod this week. I was able to add about 1.5 GB of songs to it so far.
    Today, I am connecting to the Mac, trying to drag some new MP3 files from iTunes into the iPod folder, and it gets stuck. ITunes says it is transferring "1 of 103 tracks," and it never changes. After a while, I have to Force Quit out of iTunes.
    The iPod still plays the songs that were previously installed just fine. I just can't add any more tracks to it, even though most of the space is still available.

    iTunes cannot import nor play Sony OpenMG files. You'll have to see if it's possible to convert them to a format iTunes can import. For tracks purchased from their store, you're best hope is if their store allows those tracks to be burned to an audio CD. This site may be of help.
    Good luck.

Maybe you are looking for