我用的是NLTK的nltk.tag.stanford,需要调用java可执行文件.
I am using NLTK's nltk.tag.stanford, which needs to call the java executable.
我将 JAVAHOME 设置为安装 jdk 的 C:Program FilesJavajdk1.6.0_25,但运行程序时出现错误
I set JAVAHOME to C:Program FilesJavajdk1.6.0_25 where my jdk is installed, but when run the program I get the error
"NLTK was unable to find the java executable! Use the config_java() or set the JAVAHOME variable"
然后我花了3个小时调试它并尝试了
Then I spent 3 hours on debugging it and tried
config_java("C:/Program Files/Java/jdk1.6.0_25/")
config_java("C:/Program Files/Java/jdk1.6.0_25/bin/")
and those without the ending "/".
但是 nltk 仍然找不到它.
However the nltk still cannot find it.
有人知道出了什么问题吗?非常感谢!
Anyone has idea about what's going wrong? Thanks a loooot!
如果设置 JAVA_HOME 环境对你没有帮助,试试这个:
If setting the JAVA_HOME environment doesn't help you, try this:
config_java()
对我不起作用.我将以下几行添加到我的代码中并且它起作用了:
config_java()
did not work for me. I add the following lines to my code and it worked:
import os
java_path = "C:/Program Files/Java/jdk1.7.0_11/bin/java.exe"
os.environ['JAVAHOME'] = java_path
我正在运行 Windows 7 64 位
I am running Windows 7 64-bit
这篇关于NLTK 找不到 Java 可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!