5 ms·
This "convulted version checking method" is the default way to do it with Java, I'm not sure if there's any other programming languages that do it as well.
by tokenizerrr 12y ago
This "convulted version checking method" is the default way to do it with Java, I'm not sure if there's any other programming languages that do it as well.
- ohyesyodo 12y agoSource for that?
- MHordecki 12y agoSystem.getProperty("os.name")
- tokenizerrr 12y agoYeah, the OP[1]. A lot of the returned results are Java code, alternatively there's also [2]. [1] https://searchcode.com/?q=if%28version%2Cstartswith%28%22windows+9%22 https://searchcode.com/?q=if%28version%2Cstartswith%28%22win... [2] http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html http://docs.oracle.com/javase/tutorial/essential/environment...
- ohyesyodo 12y agoNo. He said that it was the 'default' way of doing it. Yes, it has happened X times, that does not mean it's the default way of doing it. Maybe there's some other method which is done a lot more often and hence should be considered the 'default' way.
- TillE 12y agoIt's insane to check version numbers as strings. I guess the JDK is assuming you're not actually doing anything important with those properties (eg, just writing them to a log). Python for example wraps GetVersionEx appropriately with sys.getwindowsversion()