Skip to content

Commit 4030c19

Browse files
committed
feat: use jdk4py as default
1 parent 5a5a793 commit 4030c19

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

openapi_generator_cli/__init__.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
import importlib.resources
66
import os
7-
import shutil
87
import subprocess
98
import sys
109
from typing import TYPE_CHECKING
1110

11+
from jdk4py import JAVA
12+
1213
if TYPE_CHECKING:
1314
from pathlib import Path
1415

@@ -26,18 +27,7 @@ def run(args: list[str] | None = None) -> subprocess.CompletedProcess[bytes]:
2627
subprocess.CompletedProcess[bytes]: The result of running the OpenAPI Generator CLI.
2728
2829
"""
29-
java_path: Path | str | None
30-
try:
31-
from jdk4py import JAVA
32-
33-
java_path = JAVA
34-
except ImportError:
35-
java_path = shutil.which("java")
36-
if not java_path:
37-
msg = "java runtime is not found in PATH"
38-
raise RuntimeError(msg)
39-
40-
arguments = [java_path]
30+
arguments: str | Path = [JAVA]
4131

4232
java_opts = os.getenv("JAVA_OPTS")
4333
if java_opts:

0 commit comments

Comments
 (0)