Platform

object Platform

Object with utilities to gather information about the running platform.

Properties

Link copied to clipboard

Default character set.

Link copied to clipboard

JVM Console, if the program don't have a console (i.e.: input or output redirected), an exception is thrown.

Link copied to clipboard

Number of processors available to the Java virtual machine.

Link copied to clipboard

The host name of the machine running this program.

Link copied to clipboard
val ip: String

The IP address of the machine running this program.

Link copied to clipboard

True if the program has a console (terminal, TTY, PTY...), false if I/O is piped.

Link copied to clipboard

Default locale for this instance of the Java Virtual Machine.

Link copied to clipboard

User locale consist of 2-letter language code, 2-letter country code and file encoding.

Link copied to clipboard

Name of the JVM running this program. For example: OpenJDK 64-Bit Server VM.

Link copied to clipboard
val os: String

Operating system name ('os.name' property). If null throws an exception.

Link copied to clipboard

Operating system type.

Link copied to clipboard
val pid: Long

OS Process ID.

Link copied to clipboard

Current JVM runtime.

Link copied to clipboard

Default timezone.

Link copied to clipboard

Java version aka language level. For example: 11

Link copied to clipboard

Default zone ID.

Functions

Link copied to clipboard

Add a map to system properties, overriding entries if already set.

Link copied to clipboard

Retrieve a flag (boolean parameter) by name by looking in OS environment variables first and in the JVM system properties if not found.

Link copied to clipboard
inline fun <T : Any> systemSetting(name: String): T
inline fun <T : Any> systemSetting(name: String, defaultValue: T): T
fun <T : Any> systemSetting(type: KClass<T>, name: String): T
fun <T : Any> systemSetting(type: KClass<T>, name: String, defaultValue: T): T
Link copied to clipboard
inline fun <T : Any> systemSettingOrNull(name: String): T?

Utility method for retrieving a system setting, check systemSettingOrNull for details.

fun <T : Any> systemSettingOrNull(type: KClass<T>, name: String): T?

Retrieve a setting by name by looking in OS environment variables first and in the JVM system properties if not found.

Link copied to clipboard

Amount of memory in kilobytes available to the JVM.

Link copied to clipboard
fun uptime(): Long

Milliseconds since the process was created.

Link copied to clipboard

Amount of used memory in kilobytes.