[?] compile and run java code [?] cannot find the class file [?]
Do you have multiple sources?
The Compile & Run was initially done for just running a single Java file.
That said, the command does have some poor man?s build system support by allowing you e.g. to set TM_JAVA_FILEGLOB (presumably to ?*.java?) which would call the compiler with all the matches (rather than just the current one).
The alternative would be to set CLASSPATH if you have your class files somewhere. The proper solution though is to use a build system (when you?re doing more than just a quick test).
No, it is only a single file. My wife is taking a beginner class in Java programming, and I am trying to set up a simple environment on our Mac in which she can do her homework. As she is using only very simple single files, and I want her to concentrate on the code and not the programming environment, I would like to enable her to simply press Command-R to compile and run the code. However, it appears that the system is not automatically creating the needed .class file, as shown in the complete output here: Exception in thread "main" java.lang.NoClassDefFoundError: helloworld Caused by: java.lang.ClassNotFoundException: helloworld at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Given all this, what is the best way to configure this poor man's compile-and-run environment?
I have installed the latest iteration of Netbeans IDE, but it is way too much for my wife, at least for the moment.
On Sun, Sep 9, 2012 at 5:57 PM, Michael Sheaver msheaver@earthlink.net wrote:
However, it appears that the system is not automatically creating the needed .class file, as shown in the complete output here:
My guess would be that the file is called "helloworld.java" but doesn't define a class called "helloworld" (remember that Java is case-sensitive).
HTH, Martin
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.
On 10 September 2012 06:52, Martin Kühl martin.kuehl@gmail.com wrote:
On Sun, Sep 9, 2012 at 5:57 PM, Michael Sheaver msheaver@earthlink.net wrote:
However, it appears that the system is not automatically creating the needed .class file, as shown in the complete output here:
My guess would be that the file is called "helloworld.java" but doesn't define a class called "helloworld" (remember that Java is case-sensitive).
HTH, Martin
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate