How do I compile my Python program to a .jar with Jython?

I don't know how to compile my prolog program. I'm using "SWI-Prolog" but I don't know how to compile my prolog program. I just typed it and saved in a directory. How do I do to compile it in the main screen? I tried ? - "['C:/Prolog/myfirstprolog']"

  • Answer:

    To complement 's answer, if you're using Unix/Linux or the command line, I find it best to open a shell, navigate to where the program is and load it with: [name]. With name being the program. Don't use the '.pl' extension. So if I have a module to do basic statistics in /home/alan/Prolog/http://stats.pl, I open a shell and: cd /home/alan/Prolog swipl ?- [stats]. % load my 'http://stats.pl' program ?- meanNums([2,4,5], Mean). Mean = 3.6666666666666665. The full stop / period after the program name ("[stats].") is essential.

Anonymous at Quora Visit the source

Was this solution helpful to you?

Other answers

Suppose you want to distribute only the binary and not your source code, then what you need is to create a "saved state", and specify a "main predicate" where you program starts from. For example, for your program, if your entry point is the predicate main: swipl --goal=main --stand-alone=true -o starts -c http://starts.pl and main would be: main :-     write('List=?'),     read(List),     meanNums(List, Mean),     format('Mean=~w~n', [Mean]).

Edison Mera

If you are on Windows, you should be able to click on your file (if you named it something.pl) to run it, otherwise take a look at the FAQ http://www.swi-prolog.org/FAQ/LoadProgram.html

Alexander Lehmann

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.