Skip to content

Commit

Permalink
Backing out jpype-project#1195 and working on replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrameos committed Oct 19, 2024
1 parent 9a2a604 commit 9d66c27
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions jpype/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _handleClassPath(
out.extend(glob.glob(pth + '.jar'))
else:
out.append(pth)
return out
return _classpath._SEP.join(out)


_JVM_started = False
Expand Down Expand Up @@ -238,6 +238,7 @@ def startJVM(
classpath = _classpath.getClassPath()

# Handle strings and list of strings.
extra_jvm_args = ()
if classpath:
extra_jvm_args += (f'-Djava.class.path={_handleClassPath(classpath)}', )

Expand Down Expand Up @@ -273,20 +274,20 @@ def startJVM(
raise RuntimeError(f"{jvmpath} is older than required Java version{version}") from ex
raise

"""Prior versions of JPype used the jvmargs to setup the class paths via
JNI (Java Native Interface) option strings:
i.e -Djava.class.path=...
See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html
Unfortunately, unicode is unsupported by this interface on windows, since
windows uses wide-byte (16bit) character encoding.
See: https://stackoverflow.com/questions/20052455/jni-start-jvm-with-unicode-support
To resolve this issue we add the classpath after initialization since jpype
itself supports unicode class paths.
"""
for cp in _handleClassPath(classpath):
addClassPath(Path.cwd() / Path(cp).resolve())
# """Prior versions of JPype used the jvmargs to setup the class paths via
# JNI (Java Native Interface) option strings:
# i.e -Djava.class.path=...
# See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html
#
# Unfortunately, unicode is unsupported by this interface on windows, since
# windows uses wide-byte (16bit) character encoding.
# See: https://stackoverflow.com/questions/20052455/jni-start-jvm-with-unicode-support
#
# To resolve this issue we add the classpath after initialization since jpype
# itself supports unicode class paths.
# """
# for cp in _handleClassPath(classpath):
# addClassPath(Path.cwd() / Path(cp).resolve())


def initializeResources():
Expand Down

0 comments on commit 9d66c27

Please sign in to comment.