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

What is JAVA_HOME? #49

Open
thuychang404 opened this issue Mar 12, 2024 · 1 comment
Open

What is JAVA_HOME? #49

thuychang404 opened this issue Mar 12, 2024 · 1 comment

Comments

@thuychang404
Copy link

Hi, I'm currently running your code in my VSCode, and I came across this error:


Traceback (most recent call last):
  File "path\name\nlp.py", line 8, in <module>
    model = py_vncorenlp.VnCoreNLP(save_dir='/models')
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\py_vncorenlp\vncorenlp.py", line 53, in __init__
    from jnius import autoclass
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\jnius\__init__.py", line 18, in <module>        
    java = get_java_setup(sys.platform)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\jnius\env.py", line 60, in get_java_setup
    JAVA_HOME = get_jdk_home(platform)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\jnius\env.py", line 335, in get_jdk_home
    raise Exception('Unable to find JAVA_HOME')
Exception: Unable to find JAVA_HOME

I really don't get it. Please help.
P/S: The code I'm using:

import py_vncorenlp
import os
import shutil

# Load VnCoreNLP model
model = py_vncorenlp.VnCoreNLP(save_dir='/models')

# Annotate a raw text
text = "Ông Nguyễn Khắc Chúc đang làm việc tại Đại học Quốc gia Hà Nội. Bà Lan, vợ ông Chúc, cũng làm việc tại đây."
annotated_text = model.annotate(text)
print(annotated_text)

# Annotate a file
input_file_path = "/input.txt"
output_file_path = "/output.txt"
model.annotate_file(input_file=input_file_path, output_file=output_file_path)
@vantanco
Copy link

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