Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This problem appeared with the jpyp library, and it gives me the suggestion to add JAVA_HOME to the environment variable And I don't use java

Tags:

python

jpype


import  jpype     
import  asposecells     
jpype.startJVM() 
from asposecells.api import Workbook

# image path
image_name = 'screenshot.png'
image_path = fr'C:\\Users\\Bouregag Youcef\\Downloads\\Telegram Desktop\\analyses\\{image_name}'

# Export the dataframe to an Excel file
excel_name = 'table2.xlsx'
excel_path = fr'C:\\Users\\Bouregag Youcef\\Downloads\\Telegram Desktop\\analyses\\{excel_name}' 


workbook = Workbook(image_path)
workbook.save(excel_path)
jpype.shutdownJVM()

================== ERROR ===================

Traceback (most recent call last):
  File "c:\Users\Bouregag Youcef\Downloads\Telegram Desktop\analyses\jpeg_to_xls.py", line 4, in <module>
    jpype.startJVM()
    ^^^^^^^^^^^^^^^^
  File "C:\Users\Bouregag Youcef\AppData\Local\Programs\Python\Python311\Lib\site-packages\jpype\_core.py", line 184, in startJVM
    jvmpath = getDefaultJVMPath()
              ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Bouregag Youcef\AppData\Local\Programs\Python\Python311\Lib\site-packages\jpype\_jvmfinder.py", line 74, in getDefaultJVMPath
    return finder.get_jvm_path()
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Bouregag Youcef\AppData\Local\Programs\Python\Python311\Lib\site-packages\jpype\_jvmfinder.py", line 212, in get_jvm_path
    raise JVMNotFoundException("No JVM shared library file ({0}) "
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.

I searched and found some suggestions, among them is to add java_home to environment variable and I do not and have not used it at all JAVA

like image 557
Youcef Bouregag Avatar asked Sep 20 '25 08:09

Youcef Bouregag


1 Answers

I solved the problem by downloading and installing jdk and finally adding it to environment variable with name "JAVA_HOME"

https://www.oracle.com/eg/java/technologies/downloads/#jdk19-windows

like image 146
Youcef Bouregag Avatar answered Sep 21 '25 22:09

Youcef Bouregag