- Java 21
- Docker
Technologies used in this project, and so technologies that you should know before contributing.
- Java
- Spring
- Gradle
- Docker (knowing Docker is the most important thing in this project)
There are two projects, JShellAPI and JShellWrapper.
JShellAPI is a REST API, where whenever some code is received, it will create a session, by creating a docker container, which will run JShellWrapper inside and then execute the given code.
There are three unrelated ways to run JShellPlaygroundBackend:
- JShellWrapper alone in case you specifically want to improve or debug the wrapper
- JShellAPI in local in case you specifically want to improve or debug the API
- JShellAPI in docker in case you want to run it like it is used in production, which can be important, because the API needs to create containers from docker inside itself
This is only useful if your intent is to run the wrapper alone, without the API, for example if you want to improve the wrapper or debug it.
- Set the environment variable
evalTimeoutSeconds=15andsysOutCharLimit=1024 -
- On
Windows CMD, useset evalTimeoutSeconds=15 && set sysOutCharLimit=1024
- On
-
- On
Windows Powershell, use$env:evalTimeoutSeconds=15 && $env:sysOutCharLimit=1024
- On
-
- On
Linux Shell, useexport evalTimeoutSeconds=15 && export sysOutCharLimit=1024
- On
- Run
./gradlew JShellWrapper:run - Alternatively, run:
-
- On
Windows CMD,set evalTimeoutSeconds=15 && set sysOutCharLimit=1024 gradlew JShellWrapper:run
- On
-
- On
Windows Powershell,$env:evalTimeoutSeconds=15 && $env:sysOutCharLimit=1024 ./gradlew JShellWrapper:run
- On
-
- On
Linux Shell,evalTimeoutSeconds=15 sysOutCharLimit=1024 ./gradlew JShellWrapper:run
- On
- Go in Run → Run... → Edit Configurations → create a gradle configuration
- Select the command
JShellWrapper:run - Click on modify options, and check
VM options - Then add
evalTimeoutSeconds=15;sysOutCharLimit=1024in the VM options - Press the run button

- Launch Docker
- Run
./gradlew :JShellWrapper:jibDockerBuildto build the image - Run
./gradlew bootRun
- Launch Docker
- Run
JShellWrapper:jibDockerBuildto build the image - Run
bootRun
- Launch Docker
- Run
./gradlew jibDockerBuildto create the image - Create a folder outside the project
cdto this folder- Copy
docker-compose.yamlinside it - Optionally, create
config/application.yamlwhere you can put custom config (see the actual application.yaml)
-
- If you don't create it, delete the
command: ["--spring.config.location=file:///home/backend/config/application.yaml"]line in thedocker-compose.yaml
- If you don't create it, delete the
- Run
docker compose buildordocker-compose buildin the folder, depending on your version of Docker. - Run
docker compose startordocker-compose startin the folder, depending on your version of Docker. - Note that some folders or files may be created automatically inside this folder
- File tree representation:
-folder outside the project
-docker-compose.yaml
-config (optionnal)
-application.yaml
Create a session called test and execute 2+2 on it.
Note that the port might be different.
curl --request POST --url http://localhost:8080/jshell/eval/test --data '2+2'See JShellAPI README
