@@ -48,13 +48,13 @@ All the codes run with Java 14 with the preview features enabled.
48
48
Each chapter comes with executable examples that you can run using jshell.
49
49
50
50
To get the examples, just clone this repository
51
- ```
52
- git clone http://github.com/forax/java-guide
51
+ ``` shell
52
+ git clone http://github.com/forax/java-guide
53
53
```
54
54
55
55
Then run jshell (at least Java 14 version)
56
- ```
57
- jshell --enable-preview
56
+ ``` shell
57
+ jshell --enable-preview
58
58
```
59
59
60
60
Then you can copy paste the examples inside jshell and see by yourself.
@@ -73,51 +73,51 @@ You can run it directly in your browser
73
73
You need to have docker already installed, then
74
74
75
75
- get the docker image from dockerhub
76
- ```
77
- docker pull forax/java-guide
76
+ ``` shell
77
+ docker pull forax/java-guide
78
78
```
79
79
- run the docker image in a container
80
+ ``` shell
81
+ docker run -p 8888:8888 forax/java-guide
80
82
```
81
- docker run -p 8888:8888 forax/java-guide
83
+ - open your browser using the ` tokenId ` printed on the console
84
+ ``` shell
85
+ firefox http://localhost:8888/? token=tokenId
82
86
```
83
- - open your browser using the ` tokenId ` printed on the console
84
- ```
85
- firefox http://localhost:8888/?token=tokenId
86
- ```
87
87
88
88
89
89
### or install everything on your laptop
90
90
You need to have python3 and Java 14 already installed, then
91
91
92
92
- clone this repository
93
- ```
94
- git clone http://github.com/forax/java-guide
95
- cd java-guide
93
+ ``` shell
94
+ git clone http://github.com/forax/java-guide
95
+ cd java-guide
96
96
```
97
97
- install [ jupyter] ( https://jupyter.org/install )
98
- ```
99
- pip install notebook
98
+ ``` shell
99
+ pip install notebook
100
100
```
101
101
- install the [ ijava 1.3.0] ( https://github.com/SpencerPark/IJava ) kernel (from Spencer Park)
102
- ```
102
+ ``` shell
103
103
wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
104
104
python3 install.py --sys-prefix
105
105
```
106
- - patch it with the repository file ` kernel.json `
106
+ - patch it with the repository file ` kernel.json ` < br >
107
107
list all kernels to see if the java kernel is installed
108
- ```
108
+ ``` shell
109
109
jupyter kernelspec list
110
110
```
111
111
then copy the file ` kernel.json ` from the folder ` docker ` to the java kernel directory
112
- ```
112
+ ``` shell
113
113
cp docker/kernel.json /path/to/jupyter/kernels/java
114
114
```
115
115
- set the env compiler option enabling the preview features
116
- ```
116
+ ``` shell
117
117
export IJAVA_COMPILER_OPTS=" --enable-preview -source 14"
118
118
```
119
119
- run the notebook
120
- ```
120
+ ``` shell
121
121
cd jupyter
122
122
jupyter notebook
123
123
```
@@ -128,6 +128,6 @@ The markdown files (.md) and the jupyter files (.ipynb) are derived/generated
128
128
from the jshell files using a small Java script.
129
129
130
130
Using java 14
131
- ```
132
- java --source 14 --enable-preview build/build.java
131
+ ``` shell
132
+ java --source 14 --enable-preview build/build.java
133
133
```
0 commit comments