File tree Expand file tree Collapse file tree 4 files changed +36
-3
lines changed
main/java/org/dflib/jjava/kernel/execution
java/org/dflib/jjava/kernel
resources/org/dflib/jjava/kernel/cp Expand file tree Collapse file tree 4 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 33* #67 JJAVA_STARTUP_SCRIPT can't start up spark
44* #102 Eval startup snippets explicitly
55* #105 Exploding classpath
6+ * #107 "java.class.path" uses an incorrect separator
67
78## 1.0-a6
89
Original file line number Diff line number Diff line change 1515public class JJavaLoaderDelegate implements LoaderDelegate {
1616
1717 private static final String CLASSPATH_PROPERTY = "java.class.path" ;
18+ private static final String PATH_SEPARATOR = System .getProperty ("path.separator" );
1819
1920 private final Map <String , byte []> declaredClasses ;
2021 private final Map <String , Class <?>> loadedClasses ;
@@ -57,9 +58,10 @@ public void addToClasspath(String path) throws ExecutionControl.InternalExceptio
5758 try {
5859 classLoader .addURL (Path .of (next ).toUri ().toURL ());
5960
60- String classpath = System .getProperty (CLASSPATH_PROPERTY );
61- classpath += System .lineSeparator () + next ;
62- System .setProperty (CLASSPATH_PROPERTY , classpath );
61+ System .setProperty (
62+ CLASSPATH_PROPERTY ,
63+ System .getProperty (CLASSPATH_PROPERTY ) + PATH_SEPARATOR + next );
64+
6365 } catch (MalformedURLException e ) {
6466 throw new ExecutionControl .InternalException ("Unable to resolve classpath " + next
6567 + ": " + e .getMessage ());
Original file line number Diff line number Diff line change 1+ package org .dflib .jjava .kernel ;
2+
3+ import jdk .jshell .spi .ExecutionControl ;
4+ import org .dflib .jjava .kernel .execution .JJavaLoaderDelegate ;
5+ import org .junit .jupiter .api .Test ;
6+
7+ import java .io .File ;
8+ import java .net .URISyntaxException ;
9+
10+ import static org .junit .jupiter .api .Assertions .*;
11+
12+ public class JJavaLoaderDelegateTest {
13+
14+ @ Test
15+ public void addToClasspath () throws URISyntaxException , ExecutionControl .InternalException {
16+ File extraCp = new File (getClass ().getResource ("cp" ).toURI ());
17+ assertTrue (extraCp .isDirectory ());
18+
19+ JJavaLoaderDelegate ld = new JJavaLoaderDelegate ();
20+
21+ String cp1 = System .getProperty ("java.class.path" );
22+
23+ ld .addToClasspath (extraCp .getAbsolutePath ());
24+ String cp2 = System .getProperty ("java.class.path" );
25+ assertEquals (cp1 + System .getProperty ("path.separator" ) + extraCp .getAbsolutePath (), cp2 );
26+
27+ // TODO: test that classes from this location were actually loaded
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ # placeholder to keep the empty directory in version control
You can’t perform that action at this time.
0 commit comments