'Why is jpype not loading the specified .jar
I cannot load the intended jar. The java class path is not set (None)
I tried to connect to an oracle database with the JDBC driver, but the import of the ojdbc8.jar is failing
Here is my code
jpype.addClassPath('ojdbc8.jar')
jpype.startJVM()
The JVM is starting, but the class path is none
print(jpype.getClassPath())
print(jpype.java.lang.System.out.println("java.class.path"))
print(jpype.JClass("driver.class.Name"))
The output is:
D:\06_Python_Programme\WPy64-3740\notebooks\ojdbc8.jar
None
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-ac29a5fbe025> in <module>
2 print(jpype.getClassPath())
3 print(jpype.java.lang.System.out.println("java.class.path"))
----> 4 print(jpype.JClass("driver.class.Name"))
5 print(jpype.JClass('oracle.jdbc.driver.OracleDriver'))
D:\06_Python_Programme\WPy64-3740\python-3.7.4.amd64\lib\site-packages\jpype\_jclass.py in __new__(cls, jc, loader, initialize)
97
98 # Pass to class factory to create the type
---> 99 return _jpype._getClass(jc)
100
101
TypeError: Class driver.class.Name is not found
If I try the following, the problem stays the same:
jpype.startJVM(jpype.getDefaultJVMPath(), '-Djava.class.path=/ojdbc8.jar')
I would guess that it is an easy fix, but I have no idea how to fix it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
