Java System Propties Repository

1266 ワード

Java System Propties Repository
http://tolstoy.com/samizdat/sysprops.html  
    ==》 多くのOSにおける具体的なjava.get properties()の値が与えられている。
http://www.rgagnon.com/javadetails/java-0150.html
    ==》
  
I found that,on Windows 2003 server,the property value for“os.name”is actually“windows 2003.”So eigther that has to be added to the bunch of tests or just relax the compristings a bit:
  else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 2000") > -1 )
|| (OS.indexOf("windows 2003") > -1 )  // works but is quite specific to 2003
|| (OS.indexOf("windows xp") > -1) ) {
else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 20") > -1 )  // probably is better since no other OS would return "windows" anyway
|| (OS.indexOf("windows xp") > -1) ) {
I started with「windows 200」but thought「what the hell」and made it「windows 20」to lengthen its longivity.You could push it Frther and use「windows 2」I suppose.The only thing watwint for to windows.with。 
 
結論:
できるだけ変数を使って、オペレーティングシステムの種類を定義して、異なるオペレーティングシステムでオペレーティングシステムの種類の定義を変更します。そうでないと、オペレーティングシステムの今後の変化に伴い、新しいOS Nameが導入される可能性があります。