xcode help

Discussion in 'Mac Programming' started by sk3pt1c, Jan 20, 2006.

  1. macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #1
    i've installed xcode on my powerbook
    and i imported some java files from my pc
    i tried opening and running two .java files
    it opens them but i can't run them
    i can't build and run the project
    i can't run a .jar file i've made using jbuilder on my pc
    also,i can't see the applet itself on a test web page i created
    do i need to set something else up or install extra packages?
     
  2. thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #2
    Help Someone!!!
     
  3. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    OK. Lets try and find out what you have done.

    You started XCode and started a new project and chose what as the type of project?

    When you say you tried to run .java file what do you mean? .java files are source files and cannot be executed. .class files can be executed if the source .java file defines a main method.

    How are you trying to run the jar file? Double clicking on it? From the command line?
     
  4. thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #4
    i double clicked on the .java files and they opened with xcode
    i had two files open and i tried to build (compile and run)
    but the option was greyed out
    i double clicked on the .jar file to run it but nothing happened
    i double click it on my pc and it works just fine
     
  5. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    OK. Lets abandon XCode for the moment. If you use the terminal can you compile them via javac then run them via java?
     
  6. macrumors P6

    Peace

    Joined:
    Apr 1, 2005
    Location:
    Space--The ONLY Frontier
    #6
    It all depends on what version of XCode and Java is being used..

    I might also add that Microsofts Java is not compliant with Suns..

    OS X uses Sun Java
    It's likely your java app was compiled using a different platform and wont compile under OS X without some code changes.
     
  7. thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #7
    ok,it runs from the terminal with javac and java fine

    when i double click on the .java files it opens them with xcode (2.1)
    it opens them but the build options (as most options) are still greyed out
    i think i've got java 1.5 so it should work
    don't understand why it doesn't
     
  8. macrumors 6502

    Joined:
    Jan 29, 2002
    Location:
    NJ
    #8
    I am guessing you are opening the .java files from the finder via double click. If you want to build a java app in xcode I would guess you need to create a java project via File>New Project in xcode, then import your source files and build.
     
  9. thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #9
    tried that too
    doesn't work
    it should build anyway
    jbuilder does
     
  10. macrumors 6502

    Joined:
    Nov 30, 2005
    #10
    What steps did you take to import the Java into your project? And have you considered less frequent use of the enter button?
     
  11. thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #11
    i didn't use the enter button,i have a wireless mouse and i double clicked on the files
    opened them both and tried to build
    didn't work
    i also tried creating a project with xcode and opened and re-saved the files as .java and still couldn't build
    any proper help?
    i can make jokes about over using buttons and such too but i need some real help and not critisism
    thanks
     
  12. macrumors 6502

    Joined:
    Oct 2, 2003
    Location:
    Sydney, Australia
    #12
    I've not used java for awhile, but I think you don't want to be opening the files in this way, you want to add them to your project via the "Project/Add to Project..." menu item. It will then add them to the source list on the left pane.
     

Share This Page