Will this be useful..
ThreadMXBean temp = ManagementFactory.getThrea
ThreadInfo t = temp.getThreadInfo(1, Integer.MAX_VALUE);
System.out.println("Name: " + t.getThreadName());
StackTraceElement st[] = t.getStackTrace();
System.out.println("Main Class Name: " + st[st.length - 1].getClassName());
This prints the Main Class Name..
This can be executed only in jdk 1.6
Main Topics
Browse All Topics





by: Bart_CrPosted on 2008-02-21 at 05:42:34ID: 20947587
When running on a Sun VM you could use the undocument VMSupport class:
tPropertie s().getPro perty("sun .java.comm and");
String cmd = sun.misc.VMSupport.getAgen
This will give you the actual java command used to launch the application.