Re: Pass parameter to the JVM at startup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Pass parameter to the JVM at startup

Michael Echerer
Michael Echerer wrote:
>>Shouldn't it have the "-server" in there if it is running in server mode?
>>
>>How can I tell that the JVM is actually running in server mode?
>
>
> well, not sure if you can. I'd try java.lang.System.getProperties() or
> something...
>
>
Yupp... works... Just run my junitreport via ant which also dumps lots
of system properties, too:

"java.vm.name" is what you are looking for, e.g.

java.runtime.name Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version 1.4.2_05-b04
java.specification.name Java Platform API Specification
java.specification.vendor Sun Microsystems Inc.
java.specification.version 1.4
java.util.prefs.PreferencesFactory java.util.prefs.WindowsPreferencesFactory
java.vendor Sun Microsystems Inc.
java.vendor.url http://java.sun.com/
java.vendor.url.bug http://java.sun.com/cgi-bin/bugreport.cgi
java.version 1.4.2_05
java.vm.info mixed mode
java.vm.name Java HotSpot(TM) Client VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Sun Microsystems Inc.
java.vm.specification.version 1.0
java.vm.vendor Sun Microsystems Inc.
java.vm.version 1.4.2_05-b04


Hence you should be able to distinguish the Client VM vs. Server VM with
a simple JSP printing those properties.

Cheers,
Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Pass parameter to the JVM at startup

Matt Galvin
> >>How can I tell that the JVM is actually running in server mode?
> >
> >
> > well, not sure if you can. I'd try java.lang.System.getProperties() or
> > something...
> >
> >
> Yupp... works... Just run my junitreport via ant which also dumps lots
> of system properties, too:
>
> "java.vm.name" is what you are looking for, e.g.
> [...]
> Hence you should be able to distinguish the Client VM vs. Server VM with
> a simple JSP printing those properties.

Yea it works :) I did a very simple:

<%= java.lang.System.getProperty("java.vm.name") %>

in a JSP and it shows " Java HotSpot(TM) Server VM".

Looking back I was starting Tomcat from inside Eclipse with the Sysdeo
Tomcat Plugin which apparently doesn't use the tomcat startup scripts,
i.e., it bypasses startup.sh so it never sees -server. When I started
tomcat manually via the cli with startup.sh with the JAVA_OPTS in
catalina.sh it did see the -server option and it does indeed show up
on the cli too:

--- snip ---
mgalvin  12399     1 99 14:01 pts/0    00:00:04 /opt/java/bin/java
-server -Djava.endorsed.dirs=/opt/tomcat/common/endorsed -classpath
/opt/java/lib/tools.jar:/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/commons-logging-api.jar
-Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat
-Djava.io.tmpdir=/opt/tomcat/temp
org.apache.catalina.startup.Bootstrap start
--- snip ---

Thanks Again Micheal,

Matt

> Cheers,
> Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Pass parameter to the JVM at startup

Michael Echerer

> Looking back I was starting Tomcat from inside Eclipse with the Sysdeo
> Tomcat Plugin which apparently doesn't use the tomcat startup scripts,
> i.e., it bypasses startup.sh so it never sees -server. When I started
> tomcat manually via the cli with startup.sh with the JAVA_OPTS in
> catalina.sh it did see the -server option and it does indeed show up
> on the cli too:
>
Nevertheless you can also configure the start options (e.g. to adjust
the memory usage) when using the Sysdeo plugin... There's a dialog for
this in Eclipse/Sysdeo as the startup scripts aren't used, as you mentioned.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]