> Date: Mon, 10 Sep 2012 07:08:15 +1000
> From: David Howden <dhowden(a)gmail.com>
> To: TextMate users <textmate(a)lists.macromates.com>
> Subject: [TxMt] Re: Java Compile and run
> Message-ID:
> <CAP2kWKHah0sAKbNzh9GFwb6q-YfzJ=dqrSUDHgxrLoe9rvjqvg(a)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.
}
}
> [?] 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.
I have Max OS X 10.8.1 and am using TM 2.0 (9302), and am having trouble getting it to compile and run java code from within TM. It cannot find the class file, as shown here:
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
Caused by: java.lang.ClassNotFoundException: helloworld
My guess is that a needed environment variable is not set, but I cannot find any documentation on what to set. Any ideas?
I've noticed, in all of the beta versions of TM2 I've tested yet, that
the arrow button to expand the text fields for multiple lines doesn't
work. (See here: http://bit.ly/P3RASq)
Is there a plan to fix this?
Cheers!
--
Nicolas Vaughan
Allan,
thought you might be interested to know: if I set the "Save:" popup to "Nothing" in the bundle editor I no longer see the broken syntax colouring after running my uncrustify command, so it seems to have something to do with saving immediately before. I notice that similar reformatting commands, such as the XML Tidy command also save nothing, and they also work, but they too break if you set "Save:" to "Current Document".
Chris
I just switched from TextMate 1 to TextMate 2. In TextMate 1, it was
possible to have .c and .h files in different folders and when I would use
the command go to file counterpart (⌥⌘↑) it would open the counterpart. In
TextMate 2, it will only open the counterpart if they are in the same
folder. Is there something I'm doing wrong?
Thanks, -- dv
--
View this message in context: http://textmate.1073791.n5.nabble.com/Open-Counterpart-tp25611.html
Sent from the textmate users mailing list archive at Nabble.com.
A recent problem cropped up in my use of the LaTeX bundle recently. Since r9295, I get the message I paste below when I try to insert a Ref-TeX Style citation in my document. This is on a mid-2007 macmini with OS 10.7.4. On my other machine, a recent macbook with OS 10.8.1, I've been updating TextMate regularly, right to r9300, and don't have any problem. My TextMate setup is the same on both machines (or so I think). How can I fix this? Any pointer appreciated,
--Gildas
Message:
Failure running “Citation (Ref-TeX Style)”.
sh: : command not found
/Users/gweltaz/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/ui.rb:182:in `load': Cannot parse a NULL or zero-length data (OSX::PropertyListError)
from /Users/gweltaz/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/ui.rb:182:in `menu'
from /Users/gweltaz/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/ui.rb:177:in `popen'
from /Users/gweltaz/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/ui.rb:177:in `menu'
from Citation (Ref-TeX Style):18
From the TM2 release notes:
2012-08-31
- Improved alignment of the gutter images and made them adjust to font size. Dennis Vennink
While I appreciate the new customization options here (have already added the gutter styling options to my own, personal theme), the new sizing results in tiny icons for me (using 12pt Inconsolata font). Does anyone else see this too, or is this just me? And, if so, is there any possibility of adding an icon size factor to the cornucopia of gutter styling options?
Thanks,
-- Phil
Hey guys, I'm trying to write a grammar file for a MATLAB-like language,
and I'm having trouble with the transpose operator. The transpose operator,
represented by the single quote, can be used in a variety of different
situations:
# Transposing a variable:
myMatrix'
# Transposing the result of a function:
myFunc( myMatrix )'
# Transposing the result of a parenthetical:
(myMatrix - 1)'
# Transposing a matrix literal:
[1,2,3]'
The first two forms are not difficult, they can be matched with simple
"match" forms. However, the parenthetical and matrix literal forms are
more difficult; using begin/end blocks in the pattern matching causes *every
*open parentheses or open square bracket to match, regardless of whether or
not there is a transpose operator matched with the closing parentheses or
square bracket. Not only does this cause performance issues, this causes
issues with nested operators such as:
([1,2,3]' - [4,5,6]')
Any ideas on how to do this the proper way? I don't really care about
matching the parentheses or the square brackets; I just care that they are
present. Positive look-behind assertions would work fabulously here, but
they can't be variable-length, so that's a no-go here.
Thanks!
-E