How can I retrieve Java vendor information without having to compile and run following script:
import java.util.Properties;
public class test
{
public static void main(String args[])
{
Properties prop = System.getProperties();
System.out.println ("JVM Vendor : " + prop.getProperty("java.vendor") );
}
}
I couldn't find it in command line options.
Note: The following will work for the Oracle JVM - not tested on others. (To get details on non-standard options execute java -X
)
You can use the non-standard -XshowSettings
flag to show all settings, or alternatively -XshowSettings:properties
to show all property settings.
So for example if you execute the following command:
java -XshowSettings:properties -version
This will show you all properties one of which is java.vendor
. Not sure if it is possible to get it to output just a single property though.
如果是JDK运行jvisualvm,请打开VisualVM应用程序,转到“系统属性”选项卡
If you have any running java app 'jinfo' is your friend:
Usage:
jinfo [option] <pid>
(to connect to running process)
jinfo [option] <executable <core>
(to connect to a core file)
jinfo [option] [server_id@]<remote server IP or hostname>
(to connect to remote debug server)
where <option> is one of:
-flag <name> to print the value of the named VM flag
-flag [+|-]<name> to enable or disable the named VM flag
-flag <name>=<value> to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
<no option> to print both of the above
-h | -help to print this help message
So
jinfo -sysprops <pid of javaprocess> | grep "java.vendor = "
gives you the system property.
Beware :
Also note that the value of system properties can be overwritten! For example, if myProperties.txt contains the following line, the java.vendor system property will be overwritten:
java.vendor=Acme Software Company
You may use below command
$ java -XshowSettings:properties -version
Below is good blog on JAVA properties for Linux and Windows
if it's Tomcat goto: TOMCAT_HOME/bin/
and then execute the version.sh file (*eg ./version.sh).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.