I'm writing a plugin for emacs to compile and run a java source file with one keystroke. Now I would like to find out the name of the main class or if there is none. Anyone knows how to match a java main class name with regexp?
My first thought, in pseudo code regex is
edit- this is how far I've come. Not fully functionally yet but almost...
(?<=class ).*[^ ](?= *{.*public static void main)
I hate regex but still i like it. It's just that it's so hard to master.
The main class in Java does not have to have any particular name. In fact, a Java project can have several main classes, all with different names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With