Set system environment variable JAVA_HOME = C:\Program Files\Java\jdk-23\bin
(earlier i set it to JAVA_HOME = C:\Program Files\Java\jdk-23 and it had the same problem
(base) C:\Users\chivo>conda activate adore
(adore) C:\Users\chivo>python
Python 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import py5
Error occurred during initialization of VM
Could not find agent library instrument on the library path, with error: Can't find dependent libraries
Module java.instrument may be missing from runtime image.
At a dead-end here. I am trying to install py5 so that I can use it in my jupyter notebook world.
Besides these 3 standard command-line troubleshoot checks:
echo %JAVA_HOME%
where java
java -version
We can run the âSystem Propertiesâ in order to edit the âEnvironment Variablesâ: %SystemRoot%\System32\SystemPropertiesAdvanced.exe
The âEnvironment Variablesâ is split in 2 parts: âUserâ & âSysâ vars.
Make sure var JAVA_HOME is set on both parts and has this string value: %ProgramFiles%\Java\jdk-23\bin %ProgramFiles%\Java\jdk-23
In my laptop itâs %ProgramFiles%\Java\jdk-21 b/c thatâs my current Java version.
After setting the var JAVA_HOME in both places, access the var Path on the âUserâ section.
If it doesnât exist yet, add %JAVA_HOME%\bin as 1 of its entries, and move it up, making sure itâs 1 of the top entries.
You can also add a %CommonProgramFiles%\Oracle\Java\javapath entry to the Path, which is a folder containing the default Java versionâs basic executables.
Now do the same for the âSysâ section and youâre done.
If you prefer, you can restart Windows to make sure those changes will take effect.
Now I believe import py5 should be able to find your JDK Java; letâs hope so.
EDIT: Chat AI stated we shouldnât use â\binâ for the JAVA_HOME variable!
So you should just use %ProgramFiles%\Java\jdk-23 as the JAVA_HOME value.
Then add it as a var âPathâ entry like this: %JAVA_HOME%\bin
Somehow i missed the more elaborate instructions at Install py5 â py5 documentation I created a new environment based on http://py5coding.org/files/install/py5_environment.yml
pip install install-jdk and jdk.install(â17â)
it still didnât work, so I had to create JAVA_HOME env var
it still didnât work, so I added JAVA_HOME to my PATH as well
Then it worksâŚ
Be aware all those packages minimum versions are too old, especially ânumpyâ!
And its âpython=3.11â entry is already old too, considering current 1 is 3.13!
JDK-17 is the previous LTS version. Current Java is JDK-23, and current LTS is JDK-21!
I was mistaken about adding the subfolder â\binâ. Edit it so it doesnât have that anymore.
After removing the â\binâ from sys var %JAVA_HOME%, its entry in PATH should now include it: %JAVA_HOME%\bin