java-os-detector

Java library which returns normalized OS and architecture name based on os.name and os.arch system properties.

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.github.tnakamot
ArtifactId

ArtifactId

java-os-detector
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

java-os-detector
Java library which returns normalized OS and architecture name based on os.name and os.arch system properties.
Project URL

Project URL

https://github.com/tnakamot/java-os-detector
Project Organization

Project Organization

com.github.tnakamot
Source Code Management

Source Code Management

https://github.com/tnakamot/java-os-detector

Download java-os-detector

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.tnakamot/java-os-detector/ -->
<dependency>
    <groupId>com.github.tnakamot</groupId>
    <artifactId>java-os-detector</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.tnakamot/java-os-detector/
implementation 'com.github.tnakamot:java-os-detector:0.2.0'
// https://jarcasting.com/artifacts/com.github.tnakamot/java-os-detector/
implementation ("com.github.tnakamot:java-os-detector:0.2.0")
'com.github.tnakamot:java-os-detector:jar:0.2.0'
<dependency org="com.github.tnakamot" name="java-os-detector" rev="0.2.0">
  <artifact name="java-os-detector" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.tnakamot', module='java-os-detector', version='0.2.0')
)
libraryDependencies += "com.github.tnakamot" % "java-os-detector" % "0.2.0"
[com.github.tnakamot/java-os-detector "0.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10

Project Modules

There are no modules declared in this project.

java-os-detector

This is a Java library providing methods to get normalized OS and architecture name based on os.name and os.arch system properties. The normalized names provided by this library is useful for platform-dependent projects.

This is a repackage of os-maven-plugin, which is meant to be used in pom.xml. On the other hands, this library is very minimal and meant to be used in other Java programs.

Below is a quote from os-maven-plugin to explain the benefit of this library.

${os.name} and ${os.arch} are often subtly different between JVM and operating system
versions or they sometimes contain machine-unfriendly characters such as whitespaces.
This plugin tries to remove such fragmentation so that you can determine the current
operating system and architecture reliably.

Install

The packages of this library are distributed through Maven Central.

Maven

Add the following lines to your pom.xml.

<dependency>
  <groupId>com.github.tnakamot</groupId>
  <artifactId>java-os-detector</artifactId>
  <version>0.2.0</version>
  <type>pom</type>
</dependency>

sbt

To use this library in your sbt project, add the following sbt setting (e.g. in build.sbt).

libraryDependencies += "com.github.tnakamot" % "java-os-detector" % "0.2.0",

Usage

This library provides only one class Detector. First import this class in your Java program.

import com.github.tnakamot.os.Detector;

This class provides two static public methods.

Detector.getNormalizedOSName();
Detector.getNormalizedArchitectureName();

They return a String of the normalized OS and architecture name respectively. To know what actually the normalized OS and architecture names are, see the description about os.detected.name and os.detected.arch properties of os-maven-plugin.

Versions

Version
0.2.0
0.1.5
0.1.4