Hacker News new | ask | show | jobs
by tokenizerrr 4273 days 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.
2 comments

It'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()

Source for that?
Yeah, 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%22win...

[2] http://docs.oracle.com/javase/tutorial/essential/environment...

No. 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.
System.getProperty("os.name")