-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
22 lines (20 loc) · 906 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
22 lines (20 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
if [ ! -f "target/classes/Main.class" ]; then
echo "Собираем проект..."
mvn clean compile
fi
if [ $# -eq 1 ] && [ -f "$1" ]; then
echo "Запуск с файлом: $1"
java -cp target/classes Main "$1"
else
echo "Интерактивный режим"
echo "=================="
echo "Примеры программ в папке examples/:"
echo " example1.txt: void test(int x) { print(x); print(2); } test(3);"
echo " example2.txt: int add(int a, int b) { return a + b; } void show(int n) { print(n); } show(add(5, 3));"
echo ""
echo "Для запуска с файлом: docker run -v \$(pwd)/program.txt:/app/program.txt translator java -cp target/classes Main /app/program.txt"
echo ""
echo "Или введите код программы (Ctrl+D для завершения):"
java -cp target/classes Main
fi