bugGNU Octave - Bugs: bug #51919, environment variable...

 
 

bug #51919: environment variable OCTAVE_JAVA_DIR

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Sat 02 Sep 2017 01:51:08 PM UTC
   
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 19 Oct 2017 11:47:07 PM UTC, comment #8: 

There are some doubts whether it is so good to use texi_macros_file as a template.

Ernst Reissner <ernstreissner>
Wed 13 Sep 2017 10:18:59 PM UTC, comment #7: 

@mike:
good hint to use texi_macros_file as a template.
I'll do soon.

Ernst Reissner <ernstreissner>
Wed 13 Sep 2017 08:46:44 PM UTC, comment #6: 

Yes, please do. Take a look at the doc for texi_macros_file for an example of another similar setting that has a default value that can be overridden but probably never should be.

Mike Miller <mtmiller>
Group Member
Wed 13 Sep 2017 08:38:06 PM UTC, comment #5: 

I have another aspect: the directory under consideration
is called initial_java_dir in the code in ov-java.cc.
Thus I call it here initial java dir.
If you have a look in the code (initial_class_path),
it plays three roles:

  • where octave.jar resides which is the initial section of the classpath
  • where the file javaclasspath.txt resides which defines the installation wide portion of the classpath which comes after the project wide and after the user-wide one.
  • where the file java.opts resides containing the (installation wide) options.


All these three files must be moved if the initial java dir is changed.
I think it is easy to document this:

If OCTAVE_JAVA_DIR is not set, this is the directory
where javaaddpath.m resides
which can be found out by 'which javaaddpath'
Otherwise, the java directory is given by OCTAVE_JAVA_DIR.

Then one has to document the three roles and that's it.

In further steps, we can try to improve this,
but i think the first step would be to add this piece of information to the documentation.

I would like to prepare a patch if you agree.

Ernst Reissner <ernstreissner>
Wed 13 Sep 2017 03:20:28 PM UTC, comment #4: 

And we already have bug #48654 if someone wants to look into adding support for java.opts to exist in more than one global directory, which I think is a good idea.

To clarify, when I said "no longer document it as something that the user should be changing", I am including the option of keeping it documented, but marking it as an expert feature. For example we also document the OCTAVE_TEXI_MACROS_FILE environment variable, but I honestly don't think a normal user has a need to set that variable.

Mike Miller <mtmiller>
Group Member
Wed 13 Sep 2017 03:16:09 PM UTC, comment #3: 

Kai - I agree with your analysis, except that there must be a way to point to octave.jar when running Octave in the build directory. Currently that is the OCTAVE_JAVA_DIR environment variable.

Solution 3. Leave the OCTAVE_JAVA_DIR environment variable as is, but no longer document it as being something that the user should be changing without knowing internal details of Octave.

Mike Miller <mtmiller>
Group Member
Wed 13 Sep 2017 11:44:50 AM UTC, comment #2: 

The conflicting section in the documentation is:

https://hg.savannah.gnu.org/hgweb/octave/file/631076eab47b/doc/interpreter/external.txi#l2112

The description is really misleading: `OCTAVE_JAVA_DIR` must remain a constant path to `octave.jar`


$ export OCTAVE_JAVA_DIR=/tmp
$ octave-cli

>> javaaddpath("/home")
error: octave.jar does not exist: /tmp/octave.jar
error: called from
    javaaddpath at line 52 column 13


vs.


$ export OCTAVE_JAVA_DIR=
$ octave-cli
>> javaaddpath("/home") # no error


Therefore I agree, that `OCTAVE_JAVA_DIR` is an example of a useless environment variable.

I can imagine two solutions:

1. The location of `octave.jar` should not rely on reading the environment variable `OCTAVE_JAVA_DIR` and is determined at compile/install time.

2. Introduce two environment variables: `OCTAVE_JAVA_DIR` and `OCTAVE_JVM_OPTS`.  The latter one obtains the JVM parameters directly in favor of a separate file `java.ops`.

I favor the first solution, as it is not likely that the location of `octave.jar` will change after the installation.

Kai Torben Ohlhus <siko1056>
Group Member
Tue 12 Sep 2017 10:28:55 AM UTC, comment #1: 

For further illustration:
after
export OCTAVE_JAVA_DIR=/home/ernst
i obtain
octave:4> javaaddpath("/home")
error: octave.jar does not exist: /home/ernst/octave.jar
error: called from
    javaaddpath at line 52 column 13

because other location of octave.jar expected.

Ernst Reissner <ernstreissner>
Sat 02 Sep 2017 01:51:08 PM UTC, original submission:  

In the documentation, it is only mentioned, that OCTAVE_JAVA_DIR,
if defined,
specifies the location of the java option file java.opts.
Nowhere is mentioned, that it also determines where octave.jar
and javaclasspath.txt is located.
If OCTAVE_JAVA_DIR is set and this is not taken into account,
octave.jar and javaclasspath.txt are no longer found.
As a consequence, part of the java classpath is missing.
In particular the java classes implementing the core of octave's java interface located in octave.jar are missing.
So the java interface does not work any longer.

THe documentation shall mention that besides java.opts also octave.jar and javaclasspath.txt shall be in the directory defined by OCTAVE_JAVA_DIR.

Ernst Reissner <ernstreissner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-22 mtmiller Carbon-CopyRemoved 80942 -
    2017-09-02 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code