BPjs is a library for executing behavioral programs written in Javascript. It can be used from the commandline, or embedded in a Java application.
BPjs is an open source project, maintained by a research group in Ben-Gurion University of the Negev, Israel.
- The BPjs GitHub repository: https://github.com/bThink-BGU/BPjs
- The BPjs Website: https://bpjs.readthedocs.io/en/latest/
- Node.js 12.16.2 (includes npm version 6.14.4) or above.
Download from https://nodejs.org/en/. - Preferably a WebStorm IDE from Jetbrains.
It is possible to run the project from the command line and edit it with any text editor (more on that in the "Running The Project" section.)
Download WebStrom from https://www.jetbrains.com/webstorm/download/#section=windows.
- Java jdk-11.0.5 and above.
Download from https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html.
Installation guide: https://www.youtube.com/watch?v=LlLRjFptXAY. - Apache-maven-3.6.3 and above.
Download from https://maven.apache.org/download.cgi.
Installation guide: https://maven.apache.org/install.html. - An Apache-tomcat-9.0.30 server.
Download from https://tomcat.apache.org/download-90.cgi. - Preferably an IntelliJ IDEA IDE (though any IDE with Maven and Jave EE support will do).
Just like the client side, is possible to build and run the project from the command line and edit it with any text editor.
More on that in the "Running The Project" section.
Download IntelliJ from https://www.jetbrains.com/idea/download/#section=windows.
First, clone/download the project from the git repository.
Through the terminal (cmd or the terminal on the IDE itself), navigate to the BPjsOnlineIDE\OnlineIDEClient\my-app folder.
Then, run the 'npm install' command and all the dependencies should install automatically.
When the installation is finished, you can run the project as explained in the "Running The Project" section.
If you are indending to run and build the server from the command line, and edit the code via some text editor (not an IDE),
skip this section and go to the next one - it has a detailed explanation.
If you are using IntelliJ, these are the steps you should take:
- Import the OnlineIDEServer folder as a Maven project.
- Run -> Edit Configurations -> + sign -> Tomcat Server -> Local
- Click 'Configure' and navigate to your Apache server folder.
- Click on the 'Deployment' tab -> + sign -> Artifact -> OnlineIDEServer:war
- IMPORTANT: Change the 'Application context' from /OnlineIDEServer_war to /OnlineIDEServer.
The client accesses the server on that address (at least when developing).
Check that the server address is http://localhost:8080/OnlineIDEServer/ and you're good to go! More information about Tomcat and IntelliJ here https://www.jetbrains.com/help/idea/run-debug-configuration-tomcat-server.html#.
Through the terminal (cmd or the terminal on the IDE itself), navigate to the BPjsOnlineIDE\OnlineIDEClient\my-app folder.
Then, run the 'npm start' command and access the client side on localhost:4200 on any browser.
Npm comes with a 'Nodemon' service built in it, so the node server will automatically restart when file
changes in the package directory are detected.
After installing and building the server for the first time like explained in the previous section, running it on any IDE should be pretty straightforward. Just choose the 'Run on server' (exact name might differ from one IDE to another) and the server should be up and running on localhost:8080/OnlineIDEServer/.
Just don't forget to ctrl+F10 (update server) every time you update your code...
If you want to run the server from the terminal, follow these steps:
- If you haven't built the server already (no 'target' folder in BPjsOnlineIDE\OnlineIDEServer), navigate to that folder through the terminal and run 'mvn install'. After that's done, a 'target' folder should appear.
- Copy the 'OnlineIDEServer' folder from the 'target' folder into the apache-tomcat-9.0.30\webapps folder (version number is redundant).
- Open the terminal in apache-tomcat-9.0.30\bin and run the 'startup' command. After that, the server should be up and running on localhost:8080/OnlineIDEServer/. Run the 'shutdown' command to terminate.
Please note: If you choose to edit the code through an the Intellij IDE (or most modern ones), the code will be built automatically every time you update (ctrl+F10) the code (depends on the settings). If you choose to work through a command line only, you will have to do steps 1-3 manually every time you want to test updated code.