forked from DrSnowbird/jdk-mvn-py3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tryJava.sh
executable file
·32 lines (25 loc) · 1.15 KB
/
tryJava.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash -x
###################################################
#### ---- Change this only if want to use your own
###################################################
ORGANIZATION=openkbs
###################################################
#### ---- Container package information ----
###################################################
DOCKER_IMAGE_REPO=`echo $(basename $PWD)|tr '[:upper:]' '[:lower:]'|tr "/: " "_" `
imageTag=${1:-"${ORGANIZATION}/${DOCKER_IMAGE_REPO}"}
mkdir -p ./data
cat >./data/HelloWorld.java <<-EOF
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
EOF
cat ./data/HelloWorld.java
djavac='docker run -it --rm --name jdk-mvn-py3 -v '$PWD'/data:/data --workdir /data '${imageTag}' javac'
djava='docker run -it --rm --name jdk-mvn-py3 -v '$PWD'/data:/data --workdir /data '${imageTag}' java'
#docker run -it --rm --name some-jdk-mvn-py3 -v $PWD/data:/data --workdir /data openkbs/jdk-mvn-py3 javac HelloWorld.java
$djavac HelloWorld.java
#docker run -it --rm --name some-jdk-mvn-py3 -v $PWD/data:/data --workdir /data openkbs/jdk-mvn-py3 java HelloWorld
$djava HelloWorld