PaperMC / Paperclip

Bootstrap utility and launcher for the Paper Minecraft server
MIT License
120 stars 51 forks source link

Simplify java version checking #44

Closed derklaro closed 2 years ago

derklaro commented 2 years ago

This also resolves issues when running with a newer java version than 17. (In my case 18-ea) which results in an exception when starting: Exception in thread "main" java.lang.NumberFormatException: For input string: "18-ea"

SirYwell commented 2 years ago

What about using java.specification.version? That should give 1.6, 1.7, 1.8, 9, ..., 18.

derklaro commented 2 years ago

What about using java.specification.version? That should give 1.6, 1.7, 1.8, 9, ..., 18.

If i read the [docs](https://docs.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties()) correctly that property was added in [Java 7](https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getProperties())...

SirYwell commented 2 years ago

If i read the docs correctly that property was added in Java 7...

It's listed in the Java 6 docs too and this site mentions 1.1 as an example value.