I am new to Prolog and Java,at this point I am using JPL, SWI-Prolog and Eclipse. I was able to write and consult my Prolog program from Eclipse(Java) but how do I write a program in Prolog that will consult a Java program? What will be the elements of the Prolog program such that it can consult my simple java calculator program?
-
PLEASE SOMEBODY HELP!!! – Destiny Anyaiwe Jan 21 '14 at 19:32
-
Say I have this parent.pl code parent(john, ann). parent(john, mike). parent(mary, mike). parent(mike, pat). parent(mike, bob). parent(pat, ben). parent(X, Y):- parent(X,Z),parent(Z,Y). And in java I have coded that X can be a parent of Y only when X is 20years older than Y. In this way I can be sure of the X I am working with if there are more than one X's. I know prolog alone can do this but JUST LEARNING HERE... – Destiny Anyaiwe Jan 27 '14 at 11:11
2 Answers
Use JPL from within Prolog:
http://www.swi-prolog.org/packages/jpl/prolog_api/overview.html#calling_methods_of_Java_objects_...

- 5,243
- 3
- 29
- 40
To install Prolog on eclipse you need a plugin called Prolog Development Tools (ProDT).
https://marketplace.eclipse.org/search/site/prolog - plugin can be found here.
To download the eclipse Marketplace... But to install this plugin you will need to download the eclipse market place client. https://marketplace.eclipse.org/content/prolog-development-tools-prodt
If dragging the install doesn't work for you, it didn't for me either, so right click and copy link address. Then in eclipse Window -> preferences -> Install/Update and find the subfolder on the left hand side within it called Avaialable Software Sites -> add -> put in a name like Marketplace and copy the address below. - > OK -> Apply and close.
Help -> Install New Software -> select MarketPlace from the drop down (or whatever you called it) and then finish.
(Or if that doesn't work try Help -> Install New Software -> Add and put in the same address and hope for the best)
If you already have the market place client then go to Help->Eclipse Marketplace -> and use the search bar to find and then download "prolog"

- 21
- 1
- 5