The fact is that in my application, depending on the battery, it is necessary to cause different methods. Actually, the question arose: how can I use the Java code to know the battery of the OS?
Answer 1, Authority 100%
Here is a piece of code from the working application:
string osname = system.getproperty ("os.name"). TolowerCase ();
String Osarch = System.GetProperty ("Os.arch"). TolowerCase ();
String SWTFILENAME =.
Osname.Contains ("Win")? "Win":
Osname.Contains ("Mac")? "MacOSX":
// osname.contains ("Linux") || Osname.Contains ("nix")? "Linux_GTK":
// Linux Version Is To Come Yet
NULL;
if (SWTFILENAME == NULL)
Throw New RuntimeException ("Unknown OS Name:" + Osname);
SWTFILENAME + = osarch.contains ("64")? "64": "32";
SWTVERSion = SWTFILENAME;
SWTFILENAME = "SWT_" + SWTFILENAME + ".JAR";
Answer 2, Authority 100%
version of the operating system, can be obtained via System Properties List :
string version = system.getProperty ("os.arch");