@@ -570,25 +570,35 @@ public List<Path> getBuilderModulePath() {
570570 }
571571
572572 private List <Path > createTruffleBuilderModulePath () {
573- List <Path > jars = getJars (rootDir .resolve (Paths .get ("lib" , "truffle" )), "truffle-api" , "truffle-runtime" , "truffle-enterprise" );
573+ Path libTruffleDir = rootDir .resolve (Paths .get ("lib" , "truffle" ));
574+ List <Path > jars = getJars (libTruffleDir , "truffle-api" , "truffle-runtime" , "truffle-enterprise" );
574575 if (!jars .isEmpty ()) {
575576 /*
576577 * If Truffle is installed as part of the JDK we always add the builder modules of
577578 * Truffle to the builder module path. This is legacy support and should in the
578579 * future no longer be needed.
579580 */
580- jars .addAll (getJars (rootDir . resolve ( Paths . get ( "lib" , "truffle" )) , "truffle-compiler" ));
581+ jars .addAll (getJars (libTruffleDir , "truffle-compiler" ));
581582 Path builderPath = rootDir .resolve (Paths .get ("lib" , "truffle" , "builder" ));
582583 if (Files .exists (builderPath )) {
583584 jars .addAll (getJars (builderPath , "truffle-runtime-svm" , "truffle-enterprise-svm" ));
585+ if (libJvmciDir != null ) {
586+ // truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
587+ // JDKs
588+ jars .addAll (getJars (libJvmciDir , "polyglot" ));
589+ }
590+ }
591+ if (libJvmciDir != null ) {
592+ // truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
593+ jars .addAll (getJars (libTruffleDir , "jniutils" ));
584594 }
585595 }
586596 /*
587597 * Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
588598 * image builder still needs it
589599 */
590600 if (libJvmciDir != null ) {
591- jars .addAll (getJars (rootDir . resolve ( Paths . get ( "lib" , "truffle" )) , "truffle-compiler" ));
601+ jars .addAll (getJars (libTruffleDir , "truffle-compiler" ));
592602 }
593603
594604 return jars ;
0 commit comments