Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35626 > unrolled thread
| Started by | Oliver Ruebenacker <curoli@gmail.com> |
|---|---|
| First post | 2016-09-21 08:25 -0700 |
| Last post | 2016-09-25 09:01 -0700 |
| Articles | 5 — 5 participants |
Back to article view | Back to comp.lang.java.programmer
Possible operating system names? Oliver Ruebenacker <curoli@gmail.com> - 2016-09-21 08:25 -0700
Re: Possible operating system names? mcheung63@gmail.com - 2016-09-21 11:44 -0700
Re: Possible operating system names? Graeme Geldenhuys <graemeg@example.net> - 2016-09-22 11:29 +0100
Re: Possible operating system names? Arne Vajhøj <arne@vajhoej.dk> - 2016-09-22 19:24 -0400
Re: Possible operating system names? Daniel Pitts <usenet@coloraura.com> - 2016-09-25 09:01 -0700
| From | Oliver Ruebenacker <curoli@gmail.com> |
|---|---|
| Date | 2016-09-21 08:25 -0700 |
| Subject | Possible operating system names? |
| Message-ID | <6f333feb-83a0-4165-8c9e-65757564d6c2@googlegroups.com> |
Hello,
Where can I get list of all common operating system names (i.e. the most common values for System.getProperty("os.name"))?
Thanks!
Best, Oliver
--
Oliver Ruebenacker
Senior Software Engineer, Diabetes Portal, Broad Institute
[toc] | [next] | [standalone]
| From | mcheung63@gmail.com |
|---|---|
| Date | 2016-09-21 11:44 -0700 |
| Message-ID | <83077510-127c-47fc-93af-8a4199167c00@googlegroups.com> |
| In reply to | #35626 |
Oliver Ruebenacker於 2016年9月21日星期三 UTC+8下午11時27分28秒寫道:
> Hello,
>
> Where can I get list of all common operating system names (i.e. the most common values for System.getProperty("os.name"))?
>
> Thanks!
>
> Best, Oliver
>
> --
> Oliver Ruebenacker
> Senior Software Engineer, Diabetes Portal, Broad Institute
Hope this help
package com.mkyong.core;
public class OSValidator {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
System.out.println(OS);
if (isWindows()) {
System.out.println("This is Windows");
} else if (isMac()) {
System.out.println("This is Mac");
} else if (isUnix()) {
System.out.println("This is Unix or Linux");
} else if (isSolaris()) {
System.out.println("This is Solaris");
} else {
System.out.println("Your OS is not support!!");
}
}
public static boolean isWindows() {
return (OS.indexOf("win") >= 0);
}
public static boolean isMac() {
return (OS.indexOf("mac") >= 0);
}
public static boolean isUnix() {
return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
}
public static boolean isSolaris() {
return (OS.indexOf("sunos") >= 0);
}
}
[toc] | [prev] | [next] | [standalone]
| From | Graeme Geldenhuys <graemeg@example.net> |
|---|---|
| Date | 2016-09-22 11:29 +0100 |
| Message-ID | <ns0bpm$1beu$1@adenine.netfront.net> |
| In reply to | #35627 |
On 2016-09-21 19:44, mcheung63@gmail.com wrote: > Hope this help So where does FreeBSD fall into that group? Java definitely works on my FreeBSD system. ;-) I guess one needs to delve into the Java source code to see how the "os.name" retrieves the actual OS name. Regards, Graeme --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2016-09-22 19:24 -0400 |
| Message-ID | <ns1p6o$u9m$1@gioia.aioe.org> |
| In reply to | #35628 |
On 9/22/2016 6:29 AM, Graeme Geldenhuys wrote: > On 2016-09-21 19:44, mcheung63@gmail.com wrote: >> Hope this help > > So where does FreeBSD fall into that group? Java definitely works on my > FreeBSD system. ;-) It does. Question is whether it is "common". :-) > I guess one needs to delve into the Java source code to see how the > "os.name" retrieves the actual OS name. The source code for each platform. :-( I believe that part is using OS specific call (on Windows it uses GetVersionEx). Arne
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <usenet@coloraura.com> |
|---|---|
| Date | 2016-09-25 09:01 -0700 |
| Message-ID | <ns8sd4$gp0$1@dont-email.me> |
| In reply to | #35626 |
On 9/21/16 8:25 AM, Oliver Ruebenacker wrote:
>
> Hello,
>
> Where can I get list of all common operating system names (i.e. the most common values for System.getProperty("os.name"))?
>
> Thanks!
>
> Best, Oliver
>
This list will necessarily be incomplete, since it is possible that Java
will be ported to other OS's in the future. OS's that may not even
exist currently.
Writing OS specific code on a platform which is intended to be mostly OS
agnostic is likely to frustrate a subset of your users that you
neglected to account for.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web