Why would the file run with no problems when using Eclipse but when I create a jar file of the same program I can't run it locally on my pc?
This is the error I get where a is an input and signal.pl is a file I pass located in Desktop:
C:\Users\HP\Desktop>java -jar ADE2.jar a signal.pl
Exception in thread "main" org.jpl7.PrologException: PrologException: error(existence_error(source_sink, a), _0)
at org.jpl7.Query.fetchNextSolution(Query.java:438)
at org.jpl7.Query.hasMoreSolutions(Query.java:342)
at org.jpl7.Query.oneSolution(Query.java:872)
at org.jpl7.Query.hasSolution(Query.java:950)
at ADE.executeGorgias(ADE.java:19)
at ADE.main(ADE.java:41)
I assume that you have two different working directories in your two scenaries.
SWI-Prolog provides the
working_directory/2predicate in the form ofworking_directory(-Old, +New).As the documentation states:
Thus, I would suggest to test
working_directory(CWD, CWD)in both cases to see if your working directory differs, which may lead to probelms when working with relative paths.Edit: You can also use
absolute_file_name/3to ensure that your "Eclipse use case" and your "jar use case" resolve the file in the same way.