Skip to content

Commit 11deca3

Browse files
committed
Change JDK fetch default from "auto" to "always"
The "auto" mode can still be used for on-demand fetching, but it is more robust to fetch a JDK with known characteristics rather than relying on whatever the user happens to have installed, regardless of Java version. See tlambert03/bffile#16.
1 parent a2b8bed commit 11deca3

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/scyjava/_jvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def jvm_version() -> tuple[int, ...]:
7070
default_jvm_path = jpype.getDefaultJVMPath()
7171
if not default_jvm_path:
7272
raise RuntimeError("Cannot glean the default JVM path")
73-
print(f"Default JVM path from JPype: {default_jvm_path}")
73+
_logger.debug(f"Default JVM path from JPype: {default_jvm_path}")
7474

7575
# Good ol' macOS! Nothing beats macOS.
7676
jvm_path = default_jvm_path.replace(

src/scyjava/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
_logger = _logging.getLogger(__name__)
1414

1515
# Constraints on the Java installation to be used.
16-
_fetch_java: str = "auto"
16+
_fetch_java: str = "always"
1717
_java_vendor: str = "zulu-jre"
1818
_java_version: str = "11"
1919
_maven_url: str = "tgz+https://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz" # noqa: E501
@@ -55,10 +55,10 @@ def set_java_constraints(
5555
Set constraints on the version of Java to be used.
5656
5757
:param fetch:
58-
If "auto" (default), when a JVM/or maven cannot be located on the system,
59-
[`cjdk`](https://github.com/cachedjdk/cjdk) will be used to download
60-
a JDK/JRE distribution and set up the JVM.
61-
If "always", cjdk will always be used; if "never", cjdk will never be used.
58+
If "always" (default), cjdk will always be used; if "never", cjdk will
59+
never be used. If "auto", when a JVM/or maven cannot be located on the system,
60+
[`cjdk`](https://github.com/cachedjdk/cjdk) will be used to download a
61+
JDK/JRE distribution and set up the JVM.
6262
:param vendor:
6363
The vendor of the JDK/JRE distribution for cjdk to download and cache.
6464
Defaults to "zulu-jre". See the cjdk documentation for details.

tests/it/jvm_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
assert_that(len(before_version)).is_greater_than_or_equal_to(1)
1414
assert_that(before_version[0]).is_greater_than(0)
1515

16+
scyjava.config.set_java_constraints(fetch="never")
1617
scyjava.config.enable_headless_mode()
1718
scyjava.start_jvm()
1819

0 commit comments

Comments
 (0)