'jpype ignores jar and has empty class path

I have a jar in the directory ~/jars/my_jar.jar and want to load it with

import jpype
from jpype import imports
jpype.startJVM(classpath="~/jars/my_jar.jar")

Then calling standard java classes works fine:

from java.util import Random
Random().nextInt()

But the class path is empty jpype.getClassPath(). Also importing classes from my jar fails.

from my.own.package import MyClass
// Java package 'my' not found

How do I specify the class path and import my jar?



Solution 1:[1]

Replaced "~/jars/my_jar.jar" with "jars/my_jar.jar" as classpath and it works now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Seb