Skip to content

Commit 4ffa927

Browse files
chore: trimmed down comments
1 parent 4a2714d commit 4ffa927

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

jneqsim/dependencies.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ neqsim:
1919
base_url: "https://github.com/equinor/neqsim/releases/download"
2020
# JAR file patterns for different Java versions
2121
# Note: The code will try multiple naming patterns per Java version
22-
# (e.g., Java21-Java21, Java21, then default) to handle variations
22+
# (e.g., Java21-Java21, Java21) to handle variations
2323
assets:
2424
java8: "neqsim-{version}-Java8.jar"
25-
java11: "neqsim-{version}.jar" # Default Java 11+ version
25+
java11: "neqsim-{version}.jar" # Java 11+ version
2626
java21: "neqsim-{version}-Java21.jar"
2727

2828
# Logging configuration
2929
logging:
3030
level: "INFO" # DEBUG, INFO, WARNING, ERROR
3131
show_progress: true
3232

33+
# Cache stores one JAR file per version/Java version combination
3334
cache:
3435
enabled: true
3536
verify_integrity: true
36-
# Cache stores one JAR file per version/Java version combination

jneqsim/jvm_service.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,21 @@ def get_neqsim_jar_path(version: tuple[int, ...]) -> str:
3030
raise RuntimeError(f"Failed to resolve NeqSim dependency for Java {'.'.join(map(str, version))}: {e}") from e
3131

3232

33-
# Initialize JVM with enhanced dependency resolution (only if JPype is available)
34-
neqsim = None # Default to None
33+
# Initialize JVM and NeqSim package
34+
neqsim = None # Default to None, cannot use NeqSim if JVM fails to start
3535

3636
if JPYPE_AVAILABLE and jpype and not jpype.isJVMStarted():
37+
# We need to start the JVM before importing the neqsim package
3738
try:
38-
# Get the NeqSim JAR path first
3939
jar_path = get_neqsim_jar_path(jpype.getJVMVersion())
40-
41-
# Start JVM with classpath
4240
jpype.startJVM(classpath=[jar_path])
4341

44-
# Import jpype.imports after JVM is started
4542
import jpype.imports
4643

4744
# This is the java package, added to the python scope by "jpype.imports"
4845
neqsim = jpype.JPackage("neqsim")
4946
except Exception as e:
50-
# If JVM startup fails, leave neqsim as None
51-
# This allows the module to be imported without JPype working
47+
# JVM Start failed, handle gracefully
5248
import warnings
5349

5450
warnings.warn(f"Failed to initialize JVM: {e}. NeqSim functionality will not be available.", stacklevel=2)

0 commit comments

Comments
 (0)