Question

I am using Tomcat 7. JDK1.6.

I was trying to get the list of runtime JVM.

Code:

for (int i=0; i<VirtualMachine.list().size(); i++) {
    VirtualMachineDescriptor vi = VirtualMachine.list().get(i);
        System.out.println("**PID :"+vi.id()+" **DISPLAYNAME:"+vi.displayName());
}

It works fine when I compile it in Eclipse. But when I exported it in to a war package, and put the war file into webapps folders of Tomcat, it returns empty list. And eclipse use the same tomcat too. I found that configuration files in eclipse are same with those files in tomcat. But there are bootstrap entries and user entries in eclipse. User entries are pointed to Tomcat 7. I want to try to set same configuration to Tomcat, but I don' t know how to set bootstrap entries to Tomcat. enter image description here

Was it helpful?

Solution

When I debugged the tools.jar code and found the root cause, In short, what you need to do is just remove the all the following setting in catalina.bat or catalina.sh, before you start tomcat on windows or unix. Enjoy it! :-)

-Djava.io.tmpdir="%CATALINA_TMPDIR%"

Welcome discussion, maybe there are much earier way then mine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top