This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
edit: Solved it myself. When saving files in Coda I should not save it like: test.java but just test. If I add the .java part it messes things up.
I am running Mac OS X Leopard and I'm using Coda to write my Java with. Since Coda doesn't have its own compiler I need to use the Terminal to compile and run my java files.
I wrote a simple thing that had a jframe with a button and a text field where you could input a few characters. The button didn't do anything and it is just very basic. I used the terminal to go to the folder where the file was and I wrote:
It seemed to work fine and I got no errors. When I tried to run it the little app icon in the dock appeared but then it disappeared right after. It just closed itself. I took the same code and put it into NetBeans and compiled and ran it from there and the thing showed up and it worked right away.
I really want to keep using Coda but I don't want to have to move my code into NetBeans all the time to compile and run it. Does anyone have a clue why it crashes/closes itself right away (the jframe never even shows up) when using the Terminal?
You are supposed to write the name of the class with the main method, minus extension at the command line.
If you have an application which appears and vanishes, there may be another sort of error. Are you getting a stack trace from an Exception or anything like that? Does the prompt reappear at the terminal window?