Skip to content

Commit c644b60

Browse files
Update README.md
1 parent 1fa1d1d commit c644b60

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
11
# modularjava9example
22

33
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+

0 commit comments

Comments
 (0)