время начиная с запущенной JVM

Там, где вы определили свой класс как abc, удалите элемент, замените его контейнером и добавьте justify = "center"

Чтобы сделать это с помощью CSS, используйте text-align: center

52
задан Benny 11 March 2012 в 18:12
поделиться

3 ответа

Use this snippet:

long jvmUpTime = ManagementFactory.getRuntimeMXBean().getUptime();

or:

long jvmStartTime = ManagementFactory.getRuntimeMXBean().getStartTime();

This is the correct way of retrieving JVM up-time.

For more info see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/RuntimeMXBean.html

79
ответ дан 7 November 2019 в 09:22
поделиться

You can get the start time of the JVM in the following code:

import java.lang.management.ManagementFactory;
  import java.lang.management.RuntimeMXBean;
  ...
  RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
  long uptimeInMillis = runtimeMXBean.getUptime();

See more are http://java.sun.com/javase/6/docs/api/java/lang/management/RuntimeMXBean.html

12
ответ дан 7 November 2019 в 09:22
поделиться

Starting from Java 5, you can use JMX to find this out. Check "Using the platform MBeanserver" to find out more details. The bean you're looking for is the bean called "java.lang:type=Runtime". The attribute StartTime gives you the time the JVM was started and the Uptime attribute tells you the uptime of the JVM.

You can get a reference to the Runtime bean by executing this code: ManagementFactory.getRuntimeMXBean ();

2
ответ дан 7 November 2019 в 09:22
поделиться
Другие вопросы по тегам:

Похожие вопросы: