Skip to content

Commit a9e2b3f

Browse files
Check existence of java-benchmarks
1 parent 571c95a commit a9e2b3f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/main/java/pascal/taie/AbstractWorldBuilder.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import pascal.taie.language.natives.NativeModel;
3030
import pascal.taie.language.type.TypeSystem;
3131

32+
import java.io.File;
3233
import java.io.IOException;
3334
import java.nio.file.Files;
3435
import java.nio.file.Path;
@@ -62,6 +63,15 @@ protected static List<String> getClassPath(Options options) {
6263
if (options.isPrependJVM()) {
6364
return options.getClassPath();
6465
} else { // when prependJVM is not set, we manually specify JRE jars
66+
// check existence of JREs
67+
File jreDir = new File(JREs);
68+
if (!jreDir.exists()) {
69+
throw new RuntimeException("""
70+
Failed to locate Java library.
71+
Please clone submodule 'java-benchmarks' by command:
72+
git submodule update --init --recursive
73+
and put it in Tai-e's working directory.""");
74+
}
6575
String jrePath = String.format("%s/jre1.%d",
6676
JREs, options.getJavaVersion());
6777
try (Stream<Path> paths = Files.walk(Path.of(jrePath))) {
@@ -70,8 +80,8 @@ protected static List<String> getClassPath(Options options) {
7080
options.getClassPath().stream())
7181
.toList();
7282
} catch (IOException e) {
73-
throw new RuntimeException("Analysis on Java " + options.getJavaVersion() +
74-
" is not supported yet", e);
83+
throw new RuntimeException("Analysis on Java " +
84+
options.getJavaVersion() + " library is not supported yet", e);
7585
}
7686
}
7787
}

0 commit comments

Comments
 (0)