Opened 3 years ago

Closed 2 years ago

#28648 closed defect (duplicate)

env var _JAVA_OPTIONS breaks plotting and building docs

Reported by: schilly Owned by:
Priority: major Milestone: sage-9.1
Component: interfaces Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


On CoCalc, we configure JAVA with a _JAVA_OPTIONS env variable. When running java -version it is reported as

Picked up _JAVA_OPTIONS: -Xms64m
... usual info ...

before spitting out the version.

This causes 3d plots not to show up and the documentation can't be created.

This little change helped

diff --git a/src/sage/interfaces/ b/src/sage/interfaces/   
index 8f291fb954..568678f6c8 100644
--- a/src/sage/interfaces/                                                                             
+++ b/src/sage/interfaces/                                                                             
@@ -63,13 +63,15 @@ class JmolData(SageObject):                                                                   
             <... 'bool'>                                                                                         
-            version = bytes_to_str(subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT))      
+            output = bytes_to_str(subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT))       
+            # JAVA might output info about an env var it picks up before the version number, e.g.                
+            # "Picked up _JAVA_OPTIONS: -Xms64m\n..."                                      
+            vers_str ='.*version \"(0\.|1\.)?(\d*)[\s\S]*', output).group(2)                         
+            java_version_number = int(vers_str)                                                                  
+            return java_version_number >= 7                                                                      
         except (subprocess.CalledProcessError, OSError):                                                         
             return False                                                                                         
-        java_version_number = int(re.sub(r'.*version "(0\.|1\.)?(\d*)[\s\S]*', r'\2', version))                  
-        return java_version_number >= 7                                                                          

Change History (2)

comment:1 Changed 3 years ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:2 Changed 2 years ago by chapoton

  • Resolution set to duplicate
  • Status changed from new to closed

handled in #29281

Note: See TracTickets for help on using tickets.