I need to test if the version of osx is < 10.5 inside java is this possible?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try
System.getProperty("os.name")
and/or
System.getProperty("os.version")
It returns String
HERE you can find more info about System.getProperties
回答2:
Use System.getProperty.
System.getProperty("os.version");
The list of valid arguments for the function can be found here
回答3:
I think the System getProperties method can get that information for you. See "os.version"
回答4:
System.getProperty("os.version")
Should return a string with three values for OS X, like: 10.5.1
You can also do System.getProperty("os.name")
to make sure it's OS X in the first place