Hi Nitzan

(Mailing list changed from Octave-Maintainers to OctDev as this refers to Octave-Forge stuff, not to core Octave.)

Nitzan wrote:
PhilipNienhuis wrote:
<snip>

Did you include some check here to see if the Java package has been
loaded?
IIRC Benjamin included these in the Java pkg rather than io pkg just
because of this dependency.


I have added these checks + javaaddpath/javarmpath logic as io's
PKG_ADD/PKG_DEL (see lib/octave/packages/io-1.0.15...).

The PKG_ADD/PKG_DEL implements all the logic to add and remove the path !

I didn't put it as part of the java PKG_ADD/PKG_DEL because in such case,
maintainer of the java pkg will have to maintain the "knowledge" of which
jars are desired for the io pkg ! This probably can be part of the formal
java package !

Please review the PKG_ADD/PKG_DEL I have added to the installed io pkg and
consider to use them or implement similar logic by yourself and make that
part of the formal io package.

I took a peek:

- Good start, Nitzan!
I never bothered to look at PKG_ADD, but you did a good job at invoking it. An eye-opener for me, thanks.
(but now that I see what's inside I have some nitpicking..... apologies):

- All jars are enumerated with their full file name incl. version info.
This will break when the jars are updated.
I wrote chk_spreadsheet_support.m in such a way that version info in the name of the jar is ignored.

- Like Benjamin, you've put the jars in /bin. Benjamin did this (had to do this) because he invoked file_in_path(), that has no knowledge of /lib I'd rather have the jars in /lib. After all, the jars are Java libraries, not executables (yeah I know about the .dlls in /bin).
The location of /lib can easily be found using
   libdir = octave_config_info ("libdir")

- Why did you include chk_spreadsheet_support() in a for...end loop?
AFAICS, all you need to do is to check for a loaded Java package, and if loaded, call chk_spreadsheet_support ('/path/to/jars'). chk_spreadsheet_support itself will then sort it all out: search for the needed jars there and add the ones it found to the classpath.

I've attached a revised PKG_ADD (for io package). It works for me.
Will you (in turn) check if you agree with it, please?

I plan to add this to the io package, as you suggested.

Philip

## PKG_ADD
## add paths of io pkg java jars if java pkg is installed and loaded
pkglist = pkg('list');
javapkgind = find(cellfun(@(x) strcmp(x.name,'java'),pkglist),1,'first');
if ~isempty (javapkgind)
  javapkg = pkglist{javapkgind};
  if javapkg.loaded
    # Assume jar files are in /lib and let chk_spreadsheet_support sort it out
    libdir = octave_config_info ("libdir");
    spr_status = chk_spreadsheet_support (octave_config_info ("libdir"));
    if (spr_status)
      fprintf ('io PKG_ADD: java classes has been found in %s and added to the 
javaclasspath\n', libdir)
    endif
  endif
endif
fprintf('io PKG_ADD: run chk_spreadsheet_support([],3) to view io support\n')
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to