SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API21 May 2010

How do I get current number of live threads?

package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class ThreadCount { public static void main(String[] args) { // Get the managed bean for the thread system of the Java // virtual machine. ThreadMXBean bean = ManagementFactory.getThreadMXBean(); // Get the current number of live threads including both // daemon and non-daemon threads. int threadCount = bean.getThreadCount(); System.out.println...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API18 May 2010

How do I get the Java classpath?

The RuntimeMXBean.getClassPath() returns the Java class path that is used by the system class loader to search for class files. This method is equivalent to System.getProperty("java.class.path"). Multiple paths in the Java class path are separated by the path separator character of the platform of the Java virtual machine being monitored. package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API17 May 2010

How do I get system properties information?

package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Map; import java.util.Set; public class GetSystemProperties { public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); // Returns a map of names and values of all system // properties. This method calls System.getProperties() // to get all system properties. Properties whose // name or value...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API14 May 2010

How do I get the start time of a JVM?

package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class GetStartTime { public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); // Returns the start time of the Java virtual machine in // milliseconds. This method returns the approximate time // when the Java virtual machine started. long startTime = bean.getStartTime(); Date s...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API12 May 2010

How do I get the uptime of a JVM?

The following code snippet demonstrates how to get the time for how long has the JVM been running. package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; public class GetUptime { public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); // Returns the uptime of the Java virtual machine in // milliseconds. long uptime = bean.getUptime(); System.out.printf("Uptime...

Wayan · 1 min read
JDBC / NOTES</>↗
JDBC07 May 2010

How do I limit MySQL query result?

package org.kodejava.jdbc; import java.sql.DriverManager; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class SqlLimitExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final String PASSWORD = "s3cr*t"; public static void main(String[] args) { try (Connection connection = DriverManager.getConnection(URL,...

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.