forked from joeferner/node-java
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compile-java-code.sh
executable file
·43 lines (30 loc) · 1.06 KB
/
compile-java-code.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
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash -e
JAVA_VERSION=1.7
if [ -x /usr/libexec/java_home ]; then
# On MacOS we can do this to choose the Java 1.7 JDK
# and then let the JDK default -source and -target to 1.7
JAVA_HOME=$(/usr/libexec/java_home -v ${JAVA_VERSION})
cd test
${JAVA_HOME}/bin/javac *.java
cd ../src-java/node
${JAVA_HOME}/bin/javac *.java
cd ../../
${JAVA_HOME}/bin/javah -classpath src-java -d ./src node.NodeDynamicProxyClass
elif [ -n "$1" ]; then
JAVA_HOME=$1
JAVAC_OPTS="-source ${JAVA_VERSION} -target ${JAVA_VERSION} -bootclasspath ${JAVA_HOME}/jre/lib/rt.jar"
cd test
${JAVA_HOME}/bin/javac ${JAVAC_OPTS} *.java
cd ../src-java/node
${JAVA_HOME}/bin/javac ${JAVAC_OPTS} *.java
cd ../../
${JAVA_HOME}/bin/javah -classpath src-java -d ./src node.NodeDynamicProxyClass
else
JAVAC_OPTS="-source ${JAVA_VERSION} -target ${JAVA_VERSION} -bootclasspath /opt/jdk/jre/lib/rt.jar"
cd test
javac ${JAVAC_OPTS} *.java
cd ../src-java/node
javac ${JAVAC_OPTS} *.java
cd ../../
javah -classpath src-java -d ./src node.NodeDynamicProxyClass
fi