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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
|
%global _empty_manifest_terminate_build 0
Name: python-install-jdk
Version: 1.0.4
Release: 1
Summary: install-jdk allows you to easily install latest Java OpenJDK version. Supports OpenJDK builds from Adoptium (previously AdoptOpenJDK), Corretto, and Zulu. Simplify your Java development with the latest OpenJDK builds.
License: MIT
URL: https://github.com/jyksnw/install-jdk
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/34/d2/b1f7dfcba325cdc8af3d7920d08323814e1ba8013cee35d662137291e79a/install_jdk-1.0.4.tar.gz
BuildArch: noarch
%description
# install-jdk
  [](https://github.com/jyksnw/install-jdk/actions/workflows/release.yml) [](https://github.com/jyksnw/install-jdk/actions/workflows/github-code-scanning/codeql) [](https://www.codacy.com/gh/jyksnw/install-jdk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jyksnw/install-jdk&utm_campaign=Badge_Grade)  [](https://pypi.org/project/install-jdk/) [](https://pypi.org/project/install-jdk/)
The `install-jdk` library is a Python package that simplifies the process of installing OpenJDK on Windows, macOS, Linux and other supported operating systems, saving time and effort. `install-jdk` is a useful tool for users, developers, and system administrators who need to set up Java development environment or runtime in an automated and repeatedable fashion.
`install-jdk` has no third-party dependencies and depends solely on the standard libraries found in Python3. This means that you can easily install and use the library without having to install any additional dependencies.
`install-jdk` aims to provide as many options as possible to install an OpenJDK Java version across a wide array of operating systems and architectures. Please see each vendors OpenJDK documentation to see what operating systems and architectures they support.
## Supported OpenJDK Build Vendors
| OpenJDK Build | Status | Vendor Tags | Vendor Documentation | `install-jdk` Documentation | Source Code |
| ------------------ | ----------- | ---------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| Adoptium (default) | Implemented | Adoptium, Temurin, AdoptOpenJDK, eclipse | [Adoptium](https://adoptium.net/docs/) | [Adoptium Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Adoptium-Build-Client) | [Adoptium Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/adoptium.py) |
| Corretto | Implemented | Corretto, Amazon, AWS | [Corretto](https://docs.aws.amazon.com/corretto/index.html) | [Corretto Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Corretto-Build-Client) | [Corretto Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/corretto.py) |
| Microsoft | Planning | Microsoft | ...coming soon | | |
| Azul | Implemented | Azul, Zulu | [Azul Zulu](https://www.azul.com/downloads-new/?package=jdk#zulu) | ...coming soon | [Zulu Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/zulu.py) |
install-jdk will do its best to detect the operating system and architecture that it is running on. Currently is able to detect:
- Operating Systems
- Windows
- Linux
- MacOS
- AIX
- Architecture
- arm
- aarch64
- ppc64
- x64
- x86
## Installation
To install the install-jdk library, simply run the following command:
```bash
pip install install-jdk
```
## Usage
To use the `install-jdk` library, import it into your Python code:
```python
import jdk
```
The library provides an `install` function, which takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `path` - The location to install the downloaded OpenJDK build. If not specified, will install into `$HOME/.jdk/<VERSION>` for the Java Development Kit and `$HOME/.jre/<VERSION>` for the Java Runtime Environment.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippet:
```python
jdk.install('11')
# Platform dependent install of Java JDK 11 into $HOME/.jdk/<VERSION>
jdk.install('11', jre=True)
# Platform dependent install of Java JRE 11 into $HOME/.jre/<VERSION>
jdk.install('17', vendor='Corretto')
# Installs a Corretto build of Java 17 JDK. Defualt vendor is Adoptium
jdk.install('17', vendor='Corretto', path='/usr/local/jdk')
# Installs a Corretto build of Java 17 JDK into /usr/local/jdk
```
The library also has a `get_download_url` function that returns the URL for the given version, it takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_url = jdk.get_download_url('17', jre=True)
print(download_url)
# Obtains the platform dependent JRE download url
download_url = jdk.get_download_url('17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_url)
# Obtains OpenJDK 17 from Corretto for Linux running on aarch64
```
The library has a `download` function that will download the requested version and returns back the path to where it was downloaded. This function does not currently support overriding the default download path which is the operating systems specific TMP directory. It takes the following parameters.
- `download_url` - The URL to the file to be downloaded. Defaults to None.
- - `version` - Required when `download_version` is None and must be provided as a named parameter. The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - Must be provided as a named parameter. The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - Must be provided as a named parameter. The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - Must be provided as a named parameter. The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - Must be provided as a named parameter. A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_file = jdk.download('https://api.adoptium.net/v3/binary/latest/17/ga/windows/x64/jdk/hotspot/normal/eclipse')
print(download_file)
# Downloads the requested file and returns back the TMP locations it was stored in.
download_file = jdk.download(version='17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_file)
# Downloads the a Linux aarch64 build of Java 17 from Corretto and returns back the TMP location it was stored in.
```
The library also provided two helper properties that can be used to see what it detected as the user's operating system and architecture.
```python
print(jdk.OS)
print(jdk.ARCH)
```
## Credits
The install-jdk library uses OpenJDK builds, and is created and maintained by [jyksnw](https://github.com/jyksnw).
_This was originally a port of the GitHub Action [`installjdk`](https://github.com/AdoptOpenJDK/install-jdk) but has morphed into something much more._
### Vendor Credits
- [Adoptium](https://adoptium.net/)
- [Corretto](https://aws.amazon.com/corretto/)
- [Corretto Downloads](https://github.com/corretto/corretto-downloads)
- [Zulu](https://www.azul.com/downloads/?package=jdk)
## License
The `install-jdk` library is open-source and is distributed under the MIT license. See the [LICENSE](LICENSE.md) file for more information.
## Contribution
See [CONTRIBUTING](CONTRIBUTING.MD)
## Security contact information
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
## Sponsor This Project
[](https://github.com/sponsors/jyksnw)
[](https://tidelift.com/funding/github/pypi/install-jdk)
<a href="https://www.buymeacoffee.com/jyksnw" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
%package -n python3-install-jdk
Summary: install-jdk allows you to easily install latest Java OpenJDK version. Supports OpenJDK builds from Adoptium (previously AdoptOpenJDK), Corretto, and Zulu. Simplify your Java development with the latest OpenJDK builds.
Provides: python-install-jdk
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-install-jdk
# install-jdk
  [](https://github.com/jyksnw/install-jdk/actions/workflows/release.yml) [](https://github.com/jyksnw/install-jdk/actions/workflows/github-code-scanning/codeql) [](https://www.codacy.com/gh/jyksnw/install-jdk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jyksnw/install-jdk&utm_campaign=Badge_Grade)  [](https://pypi.org/project/install-jdk/) [](https://pypi.org/project/install-jdk/)
The `install-jdk` library is a Python package that simplifies the process of installing OpenJDK on Windows, macOS, Linux and other supported operating systems, saving time and effort. `install-jdk` is a useful tool for users, developers, and system administrators who need to set up Java development environment or runtime in an automated and repeatedable fashion.
`install-jdk` has no third-party dependencies and depends solely on the standard libraries found in Python3. This means that you can easily install and use the library without having to install any additional dependencies.
`install-jdk` aims to provide as many options as possible to install an OpenJDK Java version across a wide array of operating systems and architectures. Please see each vendors OpenJDK documentation to see what operating systems and architectures they support.
## Supported OpenJDK Build Vendors
| OpenJDK Build | Status | Vendor Tags | Vendor Documentation | `install-jdk` Documentation | Source Code |
| ------------------ | ----------- | ---------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| Adoptium (default) | Implemented | Adoptium, Temurin, AdoptOpenJDK, eclipse | [Adoptium](https://adoptium.net/docs/) | [Adoptium Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Adoptium-Build-Client) | [Adoptium Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/adoptium.py) |
| Corretto | Implemented | Corretto, Amazon, AWS | [Corretto](https://docs.aws.amazon.com/corretto/index.html) | [Corretto Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Corretto-Build-Client) | [Corretto Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/corretto.py) |
| Microsoft | Planning | Microsoft | ...coming soon | | |
| Azul | Implemented | Azul, Zulu | [Azul Zulu](https://www.azul.com/downloads-new/?package=jdk#zulu) | ...coming soon | [Zulu Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/zulu.py) |
install-jdk will do its best to detect the operating system and architecture that it is running on. Currently is able to detect:
- Operating Systems
- Windows
- Linux
- MacOS
- AIX
- Architecture
- arm
- aarch64
- ppc64
- x64
- x86
## Installation
To install the install-jdk library, simply run the following command:
```bash
pip install install-jdk
```
## Usage
To use the `install-jdk` library, import it into your Python code:
```python
import jdk
```
The library provides an `install` function, which takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `path` - The location to install the downloaded OpenJDK build. If not specified, will install into `$HOME/.jdk/<VERSION>` for the Java Development Kit and `$HOME/.jre/<VERSION>` for the Java Runtime Environment.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippet:
```python
jdk.install('11')
# Platform dependent install of Java JDK 11 into $HOME/.jdk/<VERSION>
jdk.install('11', jre=True)
# Platform dependent install of Java JRE 11 into $HOME/.jre/<VERSION>
jdk.install('17', vendor='Corretto')
# Installs a Corretto build of Java 17 JDK. Defualt vendor is Adoptium
jdk.install('17', vendor='Corretto', path='/usr/local/jdk')
# Installs a Corretto build of Java 17 JDK into /usr/local/jdk
```
The library also has a `get_download_url` function that returns the URL for the given version, it takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_url = jdk.get_download_url('17', jre=True)
print(download_url)
# Obtains the platform dependent JRE download url
download_url = jdk.get_download_url('17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_url)
# Obtains OpenJDK 17 from Corretto for Linux running on aarch64
```
The library has a `download` function that will download the requested version and returns back the path to where it was downloaded. This function does not currently support overriding the default download path which is the operating systems specific TMP directory. It takes the following parameters.
- `download_url` - The URL to the file to be downloaded. Defaults to None.
- - `version` - Required when `download_version` is None and must be provided as a named parameter. The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - Must be provided as a named parameter. The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - Must be provided as a named parameter. The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - Must be provided as a named parameter. The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - Must be provided as a named parameter. A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_file = jdk.download('https://api.adoptium.net/v3/binary/latest/17/ga/windows/x64/jdk/hotspot/normal/eclipse')
print(download_file)
# Downloads the requested file and returns back the TMP locations it was stored in.
download_file = jdk.download(version='17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_file)
# Downloads the a Linux aarch64 build of Java 17 from Corretto and returns back the TMP location it was stored in.
```
The library also provided two helper properties that can be used to see what it detected as the user's operating system and architecture.
```python
print(jdk.OS)
print(jdk.ARCH)
```
## Credits
The install-jdk library uses OpenJDK builds, and is created and maintained by [jyksnw](https://github.com/jyksnw).
_This was originally a port of the GitHub Action [`installjdk`](https://github.com/AdoptOpenJDK/install-jdk) but has morphed into something much more._
### Vendor Credits
- [Adoptium](https://adoptium.net/)
- [Corretto](https://aws.amazon.com/corretto/)
- [Corretto Downloads](https://github.com/corretto/corretto-downloads)
- [Zulu](https://www.azul.com/downloads/?package=jdk)
## License
The `install-jdk` library is open-source and is distributed under the MIT license. See the [LICENSE](LICENSE.md) file for more information.
## Contribution
See [CONTRIBUTING](CONTRIBUTING.MD)
## Security contact information
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
## Sponsor This Project
[](https://github.com/sponsors/jyksnw)
[](https://tidelift.com/funding/github/pypi/install-jdk)
<a href="https://www.buymeacoffee.com/jyksnw" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
%package help
Summary: Development documents and examples for install-jdk
Provides: python3-install-jdk-doc
%description help
# install-jdk
  [](https://github.com/jyksnw/install-jdk/actions/workflows/release.yml) [](https://github.com/jyksnw/install-jdk/actions/workflows/github-code-scanning/codeql) [](https://www.codacy.com/gh/jyksnw/install-jdk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jyksnw/install-jdk&utm_campaign=Badge_Grade)  [](https://pypi.org/project/install-jdk/) [](https://pypi.org/project/install-jdk/)
The `install-jdk` library is a Python package that simplifies the process of installing OpenJDK on Windows, macOS, Linux and other supported operating systems, saving time and effort. `install-jdk` is a useful tool for users, developers, and system administrators who need to set up Java development environment or runtime in an automated and repeatedable fashion.
`install-jdk` has no third-party dependencies and depends solely on the standard libraries found in Python3. This means that you can easily install and use the library without having to install any additional dependencies.
`install-jdk` aims to provide as many options as possible to install an OpenJDK Java version across a wide array of operating systems and architectures. Please see each vendors OpenJDK documentation to see what operating systems and architectures they support.
## Supported OpenJDK Build Vendors
| OpenJDK Build | Status | Vendor Tags | Vendor Documentation | `install-jdk` Documentation | Source Code |
| ------------------ | ----------- | ---------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| Adoptium (default) | Implemented | Adoptium, Temurin, AdoptOpenJDK, eclipse | [Adoptium](https://adoptium.net/docs/) | [Adoptium Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Adoptium-Build-Client) | [Adoptium Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/adoptium.py) |
| Corretto | Implemented | Corretto, Amazon, AWS | [Corretto](https://docs.aws.amazon.com/corretto/index.html) | [Corretto Build Client docs](https://github.com/jyksnw/install-jdk/wiki/Corretto-Build-Client) | [Corretto Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/corretto.py) |
| Microsoft | Planning | Microsoft | ...coming soon | | |
| Azul | Implemented | Azul, Zulu | [Azul Zulu](https://www.azul.com/downloads-new/?package=jdk#zulu) | ...coming soon | [Zulu Build Client src](https://github.com/jyksnw/install-jdk/blob/master/jdk/client/zulu.py) |
install-jdk will do its best to detect the operating system and architecture that it is running on. Currently is able to detect:
- Operating Systems
- Windows
- Linux
- MacOS
- AIX
- Architecture
- arm
- aarch64
- ppc64
- x64
- x86
## Installation
To install the install-jdk library, simply run the following command:
```bash
pip install install-jdk
```
## Usage
To use the `install-jdk` library, import it into your Python code:
```python
import jdk
```
The library provides an `install` function, which takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `path` - The location to install the downloaded OpenJDK build. If not specified, will install into `$HOME/.jdk/<VERSION>` for the Java Development Kit and `$HOME/.jre/<VERSION>` for the Java Runtime Environment.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippet:
```python
jdk.install('11')
# Platform dependent install of Java JDK 11 into $HOME/.jdk/<VERSION>
jdk.install('11', jre=True)
# Platform dependent install of Java JRE 11 into $HOME/.jre/<VERSION>
jdk.install('17', vendor='Corretto')
# Installs a Corretto build of Java 17 JDK. Defualt vendor is Adoptium
jdk.install('17', vendor='Corretto', path='/usr/local/jdk')
# Installs a Corretto build of Java 17 JDK into /usr/local/jdk
```
The library also has a `get_download_url` function that returns the URL for the given version, it takes the following parameters:
- `version` - The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_url = jdk.get_download_url('17', jre=True)
print(download_url)
# Obtains the platform dependent JRE download url
download_url = jdk.get_download_url('17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_url)
# Obtains OpenJDK 17 from Corretto for Linux running on aarch64
```
The library has a `download` function that will download the requested version and returns back the path to where it was downloaded. This function does not currently support overriding the default download path which is the operating systems specific TMP directory. It takes the following parameters.
- `download_url` - The URL to the file to be downloaded. Defaults to None.
- - `version` - Required when `download_version` is None and must be provided as a named parameter. The major version of the Java OpenJDK build to install (e.g. 8, 11, 17, etc.).
- `operating_system` - Must be provided as a named parameter. The target operating system. If not specified, will use the user's detected operating system if possible.
- `arch` - Must be provided as a named parameter. The target architecure. If not specified, will use the user's detected architecture if possible.
- `impl` - Must be provided as a named parameter. The Java implementation to use. Currently only supports `HOTSPOT` and dependent on the OpenJDK Build Vendor.
- `jre` - Must be provided as a named parameter. A boolean value indicating that the Java Runtime Environment should be installed. Defaults to false, which will install the Java Development Kit.
- `vendor` - The vendor to download the OpenJDK build from. If not specified, defaults to [Adoptium](https://adoptium.com). This is a named argument so must be provided like `vendor='Corretto'`. Please see the list of [Supported OpenJDK Build Vendors](#supported-openjdk-build-vendors)
Here are some example code snippets:
```python
from jdk.enums import OperatingSystem, Architecture
download_file = jdk.download('https://api.adoptium.net/v3/binary/latest/17/ga/windows/x64/jdk/hotspot/normal/eclipse')
print(download_file)
# Downloads the requested file and returns back the TMP locations it was stored in.
download_file = jdk.download(version='17', operating_system=OperatingSystem.LINUX, arch=Architecure.AARCH64, vendor='Corretto')
print(download_file)
# Downloads the a Linux aarch64 build of Java 17 from Corretto and returns back the TMP location it was stored in.
```
The library also provided two helper properties that can be used to see what it detected as the user's operating system and architecture.
```python
print(jdk.OS)
print(jdk.ARCH)
```
## Credits
The install-jdk library uses OpenJDK builds, and is created and maintained by [jyksnw](https://github.com/jyksnw).
_This was originally a port of the GitHub Action [`installjdk`](https://github.com/AdoptOpenJDK/install-jdk) but has morphed into something much more._
### Vendor Credits
- [Adoptium](https://adoptium.net/)
- [Corretto](https://aws.amazon.com/corretto/)
- [Corretto Downloads](https://github.com/corretto/corretto-downloads)
- [Zulu](https://www.azul.com/downloads/?package=jdk)
## License
The `install-jdk` library is open-source and is distributed under the MIT license. See the [LICENSE](LICENSE.md) file for more information.
## Contribution
See [CONTRIBUTING](CONTRIBUTING.MD)
## Security contact information
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
## Sponsor This Project
[](https://github.com/sponsors/jyksnw)
[](https://tidelift.com/funding/github/pypi/install-jdk)
<a href="https://www.buymeacoffee.com/jyksnw" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
%prep
%autosetup -n install-jdk-1.0.4
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-install-jdk -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Apr 25 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.4-1
- Package Spec generated
|