Is there a way to find the name of the program that is running in Java? The class of the main method would be good enough.
Or you could just use getClass(). You can do something like:
public class Foo
{
public static final String PROGNAME = new Foo().getClass().getName();
}
And then PROGNAME will be available anywhere inside Foo. If you're not in a static context, it gets easier as you could use this:
String myProgramName = this.getClass().getName();