Skip to content

Commit c2b7251

Browse files
authored
Merge pull request #1118 from ThexXTURBOXx/patch-1
Fix library class version error
2 parents c325534 + 34a85d8 commit c2b7251

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

java/src/processing/mode/java/runner/Runner.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,11 @@ public static boolean handleCommonErrors(final String exceptionClass,
774774
err.println("and your code should be rewritten in a more efficient manner.");
775775

776776
} else if (exceptionClass.equals("java.lang.UnsupportedClassVersionError")) {
777+
int javaVersion = Runtime.version().feature();
777778
listener.statusError("UnsupportedClassVersionError: A library is using code compiled with an unsupported version of Java.");
778-
err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.8 or earlier.");
779-
err.println("A library used by this sketch was compiled for Java 1.9 or later, ");
780-
err.println("and needs to be recompiled to be compatible with Java 1.8.");
779+
err.println("This version of Processing only supports libraries and JAR files compiled for Java " + javaVersion + " or earlier.");
780+
err.println("A library used by this sketch was compiled for Java " + (javaVersion + 1) + " or later, ");
781+
err.println("and needs to be recompiled to be compatible with Java " + javaVersion + ".");
781782

782783
} else if (exceptionClass.equals("java.lang.NoSuchMethodError") ||
783784
exceptionClass.equals("java.lang.NoSuchFieldError")) {

0 commit comments

Comments
 (0)