Date: Mon, 10 Sep 2012 07:08:15 +1000
From: David Howden <dhowden@gmail.com>
To: TextMate users <textmate@lists.macromates.com>
Subject: [TxMt] Re: Java Compile and run
Message-ID:
<CAP2kWKHah0sAKbNzh9GFwb6q-YfzJ=dqrSUDHgxrLoe9rvjqvg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Right, so I've had a little play with this.

1. Create a file called helloworld.java and save it on your desktop.
2. Put this in it:
public class helloworld {
   public static void main(String[] args) {
       System.out.println("Hello World!");
   }
}
3. Save again!
4. Cmd+R

This runs perfectly for me in TM2 using the default Java bundle.  Try
it on your version (checking and double checking the filename and the
class name match exactly).

Cheers,

David

Hey David,

I am pleasantly surprised, but your suggestion was what I needed! Apparently, the code I had used (below) didn't have the class defined as public. I don't understand why that would make a difference, but hey, it works, and that's what really matters. 

Many thanks!
Michael

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}