View Full Version : xcode help

Jan 20, 2006, 11:29 AM
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?

Jan 22, 2006, 07:17 AM
Help Someone!!!

Jan 22, 2006, 07:34 AM
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?

Jan 22, 2006, 10:11 AM
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

Jan 22, 2006, 10:16 AM
OK. Lets abandon XCode for the moment. If you use the terminal can you compile them via javac then run them via java?

Jan 22, 2006, 10:22 AM
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.

Jan 22, 2006, 06:11 PM
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

Jan 22, 2006, 11:22 PM
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.

Jan 23, 2006, 05:11 AM
tried that too
doesn't work
it should build anyway
jbuilder does

Thomas Harte
Jan 23, 2006, 07:37 AM
What steps did you take to import the Java into your project? And have you considered less frequent use of the enter button?

Jan 23, 2006, 06:31 PM
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

Jan 23, 2006, 06:56 PM
i also tried creating a project with xcode and opened and re-saved the files as .java and still couldn't build

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.