Skip to content

Commit

Permalink
Another fix for (broken) Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrameos committed Nov 29, 2024
1 parent 25a2408 commit 3942798
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jpype/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,11 @@ def startJVM(

# ok, setup the jpype system classloader and add to the path after startup
# this guarentees all classes have the same permissions as they did in the past
from urllib.parse import quote
extra_jvm_args += [
'-Djava.system.class.loader=org.jpype.JPypeClassLoader',
'-Djava.class.path=%s'%support_lib,
'-Djpype.class.path=%s'%classpath,
'-Djpype.class.path=%s'%quote(classpath),
'-Xshare:off'
]
else:
Expand Down
12 changes: 12 additions & 0 deletions native/java/org/jpype/JPypeClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -26,6 +27,9 @@
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.net.URLDecoder;
import java.util.logging.Level;
import java.util.logging.Logger;

public class JPypeClassLoader extends URLClassLoader
{
Expand Down Expand Up @@ -57,6 +61,14 @@ private static URL[] initial()
String cp = System.getProperty("jpype.class.path");
if (cp == null)
return new URL[0];

try
{
cp = URLDecoder.decode(cp, "UTF-8");
} catch (UnsupportedEncodingException ex)
{
// ignored
}

ArrayList<URL> path = new ArrayList<>();
int last = 0;
Expand Down

0 comments on commit 3942798

Please sign in to comment.