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

question: do we really need a JDK? #23

Open
justin2004 opened this issue Oct 2, 2024 · 4 comments
Open

question: do we really need a JDK? #23

justin2004 opened this issue Oct 2, 2024 · 4 comments

Comments

@justin2004
Copy link

this project works with a JDK (that includes javac) but can it work with a JRE (without a javac)?

this might prevent me from being able to use this project. :(

e.g. with a JRE:

Traceback (most recent call last):
...
  File "/app/triplify.py", line 33, in <module>                                                                              
    SA_ENGINE = sa.SparqlAnything()                                                                                          
                ^^^^^^^^^^^^^^^^^^^                       
  File "/home/containeruser/py/lib/python3.11/site-packages/pysparql_anything/sparql_anything.py", line 26, in __call__
    instance = super().__call__(*args, **kwargs)                                                                             
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                             
  File "/home/containeruser/py/lib/python3.11/site-packages/pysparql_anything/sparql_anything.py", line 40, in __init__
    self.receiver = SPARQLAnythingReflection(jvm_options)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                    
  File "/home/containeruser/py/lib/python3.11/site-packages/pysparql_anything/sparql_anything_reflection.py", line 45, in __i
nit__
    from jnius import autoclass 
  File "/home/containeruser/py/lib/python3.11/site-packages/jnius/__init__.py", line 45, in <module>
    from .reflect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/containeruser/py/lib/python3.11/site-packages/jnius/reflect.py", line 19, in <module>
    class Class(JavaClass, metaclass=MetaJavaClass):
  File "jnius/jnius_export_class.pxi", line 117, in jnius.MetaJavaClass.__new__
  File "jnius/jnius_export_class.pxi", line 177, in jnius.MetaJavaClass.resolve_class
  File "jnius/jnius_env.pxi", line 11, in jnius.get_jnienv
  File "jnius/jnius_jvm_dlopen.pxi", line 95, in jnius.get_platform_jnienv
  File "jnius/jnius_jvm_dlopen.pxi", line 54, in jnius.create_jnienv
  File "/home/containeruser/py/lib/python3.11/site-packages/jnius/env.py", line 60, in get_java_setup
    JAVA_HOME = get_jdk_home(platform)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/containeruser/py/lib/python3.11/site-packages/jnius/env.py", line 351, in get_jdk_home
    raise Exception('Unable to find javac')
Exception: Unable to find javac
@MarcoR1791
Copy link
Member

Hi Justin,

I've been looking at this issue for you.

In theory, I believe that this project should be able to run with a JRE only. The pyjnius dependency however requires a jdk to enable all of its features. I believe that perhaps with some exception handling we may be able to circumvent this.

My problem at the moment, however, is that I seem to be unable to download JRE that is up to date enough for me to use. The Oracle and Java website give this the v8 of the JRE but I'm being told that this is too old to use with the Sparql Anything code.

Any idea where I could obtain a more advanced JRE?

@justin2004
Copy link
Author

since i always deploy in docker i get a JRE like this:

docker run --rm -it debian:12 bash
apt-get update && apt-get install -y openjdk-17-jre
# once finished installing
root@461281bae29f:/# java --version
openjdk 17.0.12 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Debian-2deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Debian-2deb12u1, mixed mode, sharing)

@MarcoR1791
Copy link
Member

Hi Justin,

So I have uninstalled Java on my Windows machine and installed a JRE via Eclipse Adoptium and it seems to be working fine?

This is what I get:

C:\Users\mr24397>java --version
openjdk 21.0.4 2024-07-16 LTS
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode, sharing)

C:\Users\mr24397>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\mr24397>py
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysparql_anything as asa
>>> asa.SparqlAnything()
<pysparql_anything.sparql_anything.SparqlAnything object at 0x000002AAFA8DE050>
>>> exit()

@enridaga maybe has an opinion on the matter?

@justin2004
Copy link
Author

justin2004 commented Oct 11, 2024

so this project needs javac for sure?
if so a JDK is necessary (since the JRE does not come with javac)

EDIT: oh, i misread your comment. it looks like it works without javac

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

2 participants