File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1
1
# modularjava9example
2
2
3
3
This demonstrates modules and custom jre creation in JAVA 9.
4
+
5
+ #### create directory to hold modules
6
+ ````
7
+ $ mkdir -p output/mlib
8
+ ````
9
+
10
+ #### compile hello module and make hello.jar
11
+ ```
12
+ $ javac -p output/mlib -d output/classes `find com.hello -name *.java`
13
+ $ jar -c -f output/mlib/hello.jar -C output/classes .
14
+ $ /bin/rm -rf output/classes
15
+
16
+ ````
17
+
18
+ #### compile helloclient module using hello module and make helloclient.jar
19
+ ```
20
+ $ javac -p output/mlib -d output/classes ` find com.hello.client -name *.java `
21
+ $ jar -c -f output/mlib/helloclient.jar --main-class com.hello.client.HelloClient -C output/classes .
22
+ $ /bin/rm -rf output/classes
23
+ ```
24
+
25
+
26
+ #### program execution
27
+ ```
28
+ $ java -p output/mlib -m com.hello.client/com.hello.client.HelloClient
29
+ ```
30
+
31
+
32
+ #### Create custom JRE
33
+ ```
34
+ $ /bin/rm -rf helloclientimage/
35
+ jlink --module-path /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/jmods: output /mlib --add-modules com.hello --add-modules com.hello.client --output helloclientimage --launcher=helloclient=com.hello.client
36
+ ```
37
+ #### list custom jre modules
38
+ ```
39
+ $ ./helloclientimage/bin/java --list-modules
40
+ ```
41
+
42
+ #### custom jre exection
43
+ ```
44
+ $ ./helloclientimage/bin/java -m com.hello.client
45
+
46
+ ```
47
+
You can’t perform that action at this time.
0 commit comments