Skip to content

Commit

Permalink
check-java-version: require JDK 11
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Dec 9, 2024
1 parent 70f41f1 commit 570c00f
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,29 @@
package com.as3mxml.vscode;

/**
* Checks that the Java version is capable of running the AS3 & MXML language
* server.
* Checks that the Java version is capable of running the SWF debug adapter.
*/
public class CheckJavaVersion
{
public class CheckJavaVersion {
public static final int GOOD_VERSION = 0;
public static final int BAD_VERSION = 100;

public static void main(String[] args)
{
public static final int MINIMUM_MAJOR_VERSION = 11;
public static final int MINIMUM_MINOR_VERSION = 0;

public static void main(String[] args) {
String version = System.getProperty("java.specification.version");
String[] versionParts = version.split("-")[0].split("\\.");
int major = Integer.parseInt(versionParts[0]);
if (major > 1)
{
if (major > MINIMUM_MAJOR_VERSION) {
System.exit(GOOD_VERSION);
}
if (versionParts.length > 1)
{
if (versionParts.length > 1) {
int minor = Integer.parseInt(versionParts[1]);
if (major == 1 && minor >= 8)
{
if (major == MINIMUM_MAJOR_VERSION && minor >= MINIMUM_MINOR_VERSION) {
System.exit(GOOD_VERSION);
}
} else if (major == MINIMUM_MAJOR_VERSION) {
System.exit(GOOD_VERSION);
}
System.exit(BAD_VERSION);
}
Expand Down

0 comments on commit 570c00f

Please sign in to comment.