Package net.i2p.util
Class SystemVersion
java.lang.Object
net.i2p.util.SystemVersion
Methods to find out what system we are running on
- Since:
- 0.9.3 consolidated from various places
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intIdentical to android.os.Build.VERSION.SDK_INT.static StringgetArch()returns the architecture of the system running I2P as a string for reference in clients.config and plugin.config files.static intgetCores()Runtime.getRuntime().availableProcssors()static longRuntime.getRuntime().maxMemory() but check for bogus valuesstatic StringgetOS()returns the OS of the system running I2P as a lower-case string for reference in clients.config and plugin.config files.static TimeZoneThe system's time zone, which is probably different from the JVM time zone, because Router changes the JVM default to GMT.static TimeZoneThe system's time zone, which is probably different from the JVM time zone, because Router changes the JVM default to GMT.static booleanIs the wrapper present? Same as I2PAppContext.hasWrapper()static booleanis64Bit()This isn't always correct.static booleanstatic booleanisApache()Apache Harmony JVM, or Androidstatic booleanisARM()static booleanisGentoo()static booleanisGNU()gij or JamVM with GNU Classpathstatic booleanisJava(int minVersion) Handles Android alsostatic booleanHandles Android, and minVersions in both forms (e.g.static booleanisJava10()static booleanisJava11()static booleanisJava6()Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") >= 0 as it handles Android also, where java.version = "0".static booleanisJava7()Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.7") >= 0 as it handles Android also, where java.version = "0".static booleanisJava8()static booleanisJava9()static booleanstatic booleanisMac()static booleanstatic booleanstatic booleanisSlow()Our best guess on whether this is a slow architecture / OS / JVM, using some simple heuristics.static booleanstatic booleanstatic booleanisX86()static booleanisZeroVM()Is this a very slow interpreted mode VM?static void
-
Field Details
-
DAEMON_USER
- See Also:
-
GENTOO_USER
- See Also:
-
-
Constructor Details
-
SystemVersion
public SystemVersion()
-
-
Method Details
-
getOS
returns the OS of the system running I2P as a lower-case string for reference in clients.config and plugin.config files. matches the conventions of the Go cross compiler- Returns:
- the OS of the system running I2P as a lower-case string
- Since:
- 0.9.53
-
getArch
returns the architecture of the system running I2P as a string for reference in clients.config and plugin.config files. matches the conventions of the Go cross compiler- Returns:
- the architecture of the system running I2P as a string
- Since:
- 0.9.53
-
isWindows
public static boolean isWindows() -
isMac
public static boolean isMac() -
isAndroid
public static boolean isAndroid() -
isApache
public static boolean isApache()Apache Harmony JVM, or Android -
isGNU
public static boolean isGNU()gij or JamVM with GNU Classpath -
isGentoo
public static boolean isGentoo()- Since:
- 0.9.23
-
isOpenJDK
public static boolean isOpenJDK()- Since:
- 0.9.26
-
isARM
public static boolean isARM()- Since:
- 0.9.8
-
isX86
public static boolean isX86()- Since:
- 0.9.14
-
isZeroVM
public static boolean isZeroVM()Is this a very slow interpreted mode VM?- Since:
- 0.9.38
-
isSlow
public static boolean isSlow()Our best guess on whether this is a slow architecture / OS / JVM, using some simple heuristics.- Since:
- 0.9.30
-
isJava6
public static boolean isJava6()Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") >= 0 as it handles Android also, where java.version = "0".- Returns:
- true if Java 1.6 or higher, or Android API 9 or higher
-
isJava7
public static boolean isJava7()Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.7") >= 0 as it handles Android also, where java.version = "0".- Returns:
- true if Java 1.7 or higher, or Android API 19 or higher
- Since:
- 0.9.14
-
isJava8
public static boolean isJava8()- Returns:
- true if Java 1.8 or higher, false for Android.
- Since:
- 0.9.15
-
isJava9
public static boolean isJava9()- Returns:
- true if Java 9 or higher, false for Android.
- Since:
- 0.9.23
-
isJava10
public static boolean isJava10()- Returns:
- true if Java 10 or higher, false for Android.
- Since:
- 0.9.33
-
isJava11
public static boolean isJava11()- Returns:
- true if Java 11 or higher, false for Android.
- Since:
- 0.9.35
-
isJava
public static boolean isJava(int minVersion) Handles Android also- Parameters:
minVersion- e.g. 11- Returns:
- true if greater than or equal to minVersion
- Since:
- 0.9.41
-
isJava
Handles Android, and minVersions in both forms (e.g. 11 or 1.11)- Parameters:
minVersion- either 1.x or x form works- Returns:
- true if greater than or equal to minVersion
- Since:
- 0.9.41
-
is64Bit
public static boolean is64Bit()This isn't always correct. http://stackoverflow.com/questions/807263/how-do-i-detect-which-kind-of-jre-is-installed-32bit-vs-64bit http://mark.koli.ch/2009/10/javas-osarch-system-property-is-the-bitness-of-the-jre-not-the-operating-system.html http://mark.koli.ch/2009/10/reliably-checking-os-bitness-32-or-64-bit-on-windows-with-a-tiny-c-app.html sun.arch.data.model not on all JVMs sun.arch.data.model == 64 => 64 bit processor sun.arch.data.model == 32 => A 32 bit JVM but could be either 32 or 64 bit processor or libs os.arch contains "64" could be 32 or 64 bit libs -
isLinuxService
public static boolean isLinuxService() -
isWindowsService
public static boolean isWindowsService() -
isService
public static boolean isService() -
getAndroidVersion
public static int getAndroidVersion()Identical to android.os.Build.VERSION.SDK_INT. For use outside of Android code.- Returns:
- The SDK (API) version, e.g. 8 for Froyo, 0 if unknown
-
hasWrapper
public static boolean hasWrapper()Is the wrapper present? Same as I2PAppContext.hasWrapper() -
getMaxMemory
public static long getMaxMemory()Runtime.getRuntime().maxMemory() but check for bogus values- Since:
- 0.9.8
-
getCores
public static int getCores()Runtime.getRuntime().availableProcssors()- Returns:
- never smaller than 1
- Since:
- 0.9.34
-
getSystemTimeZone
The system's time zone, which is probably different from the JVM time zone, because Router changes the JVM default to GMT. It saves the old default in the context properties where we can get it. Use this to format a time in local time zone with DateFormat.setTimeZone().- Returns:
- non-null
- Since:
- 0.9.24
-
getSystemTimeZone
The system's time zone, which is probably different from the JVM time zone, because Router changes the JVM default to GMT. It saves the old default in the context properties where we can get it. Use this to format a time in local time zone with DateFormat.setTimeZone().- Returns:
- non-null
- Since:
- 0.9.24
-
main
- Since:
- 0.9.24
-