把SWI-Prolog的的JPL接口工作

问题描述 投票:2回答:1

我想用JPL创建一个图形界面到我的项目,所以我去搜查一个代码示例下手,我下载的代码,但是当我运行它,它会显示以下信息工作:

ERROR: c:/program files/swipl/library/jpl.pl:4243:
        '$open_shared_object'/3: Não foi possível encontrar o módulo especificado (this stands for "it wasn't possible to find the especified module)".

ERROR: c:/program files/swipl/library/jpl.pl:4243:
        c:/program files/swipl/library/jpl.pl:4243: Initialization goal raised exception:
        library `java' does not exist (Please add directory holding java.dll to %PATH%)
ERROR: c:/users/User/desktop/system/medical expert system.pl:4:
        Exported procedure jpl:jpl_c_lib_version/1 is not defined

当我尝试使用代码的一个功能它显示:

ERROR: Undefined procedure: jpl:jni_func/3
ERROR: In:
ERROR:   [14] jpl:jni_func(6,'javax/swing/JFrame',_10490)
ERROR:   [13] jpl:jFindClass('javax/swing/JFrame',_10522) at c:/program files/swipl/library/jpl.pl:1631
ERROR:   [12] jpl:jpl_type_to_class(class([javax|...],['JFrame']),_10554) at c:/program files/swipl/library/jpl.pl:3049
ERROR:   [11] jpl:jpl_new_1(class([javax|...],['JFrame']),['Expert System'],_10606) at c:/program files/swipl/library/jpl.pl:169
ERROR:   [10] jpl:jpl_new('javax.swing.JFrame',['Expert System'],_10664) at c:/program files/swipl/library/jpl.pl:138
ERROR:    [9] interface2 at c:/users/User/desktop/system/medical expert system.pl:180
ERROR:    [7] <user>
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.

我还挺想包含java.dll的文件夹放于系统变量PATH中,但它一直显示相同的消息我SWI-Prolog是7.6.4版64位的,我不觉得有什么不妥代码本身,因为有没有人在我下载了它从视频中抱怨它。

编辑:该消息说,现在java.dll消失,现在还有仅存的2个其他消息,我已经列入我想这是在系统变量路径有关的一切。

java prolog swi-prolog jpl
1个回答
1
投票

确保在系统变量CLASSPATH变量包含的路径捆绑SWI-Prolog中jpl.jar文件。作为例子,在我的Windows 7虚拟机,我从SWI-Prolog的范围内得到:

?- getenv('CLASSPATH', P).
P = 'c:/program files/swipl/lib/jpl.jar'.

我所有的代码,使用JPL运行在这个变量定义的罚款。此外,装载JPL库应打印像(假设最近SWI-Prolog的版本):

?- use_module(library(jpl)).
% Extended DLL search path with
%   'c:/Program Files/Java/jre1.8.0_201/bin/server'
%   'c:/Program Files/Java/jre1.8.0_201/bin'

更新

实验还限定系统变量JAVA_HOME变量。我在MacOS,我使用:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home

路径也会有所不同在Windows,并根据您所安装的Java版本,但应该用HOME结束。

© www.soinside.com 2019 - 2024. All rights reserved.