Skip to content

Commit 8f6fb8a

Browse files
tunnel: require JDK11 or higher
1 parent 870f867 commit 8f6fb8a

File tree

1 file changed

+20
-0
lines changed
  • src/main/java/com/testingbot/tunnel

1 file changed

+20
-0
lines changed

src/main/java/com/testingbot/tunnel/App.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,27 @@ private static Float getVersionFromProperties() {
7272
return 0.0f;
7373
}
7474

75+
private static final int MINIMUM_JAVA_VERSION = 11;
76+
77+
static boolean checkJavaVersion() {
78+
int major = getMajorJavaVersion();
79+
if (major < MINIMUM_JAVA_VERSION) {
80+
System.err.println("Error: TestingBot Tunnel requires Java " + MINIMUM_JAVA_VERSION + " or higher.");
81+
System.err.println("Current version: " + Runtime.version());
82+
System.err.println("Please upgrade your Java installation and try again.");
83+
return false;
84+
}
85+
return true;
86+
}
87+
88+
static int getMajorJavaVersion() {
89+
return Runtime.version().feature();
90+
}
91+
7592
public static void main(String... args) throws Exception {
93+
if (!checkJavaVersion()) {
94+
System.exit(1);
95+
}
7696

7797
final CommandLineParser cmdLinePosixParser = new PosixParser();
7898
final Options options = new Options();

0 commit comments

Comments
 (0)