Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search for JAVA_HOME on Windows #70

Open
EwoutH opened this issue Apr 7, 2023 · 0 comments
Open

Improve search for JAVA_HOME on Windows #70

EwoutH opened this issue Apr 7, 2023 · 0 comments

Comments

@EwoutH
Copy link
Contributor

EwoutH commented Apr 7, 2023

On 64-bit Windows, NetLogo is installed by default in "C:\Program Files\NetLogo 6.3.0". A Java jvm.dll is with it, located in "C:\Program Files\NetLogo 6.3.0\runtime\bin\server\jvm.dll".

Using pynetlogo on Windows, this jvm.dll isn't found by default. If pynetlogo could look there before throwing an error.

No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
Traceback (most recent call last):
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\em_framework\experiment_runner.py", line 91, in run_experiment
    model.run_model(scenario, policy)
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\util\ema_logging.py", line 152, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\em_framework\model.py", line 299, in run_model
    super().run_model(scenario, policy)
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\util\ema_logging.py", line 152, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\em_framework\model.py", line 181, in run_model
    self.model_init(policy)
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\util\ema_logging.py", line 152, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\ema_workbench\connectors\netlogo.py", line 134, in model_init
    self.netlogo = pynetlogo.NetLogoLink(
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\pynetlogo\core.py", line 188, in __init__
    jvm_path = jpype.getDefaultJVMPath()
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\AppData\Local\Programs\Python\Python311\Lib\site-packages\jpype\_jvmfinder.py", line 74, in getDefaultJVMPath
    return finder.get_jvm_path()
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ewout\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.

The current workaround is adding:

import os
os.environ["JAVA_HOME"] = 'C:/Program Files/NetLogo 6.3.0/runtime/bin/server/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant