help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with java package and xlsread


From: Philip Nienhuis
Subject: Re: Problem with java package and xlsread
Date: Sun, 24 Jun 2012 09:53:39 -0700 (PDT)

frage wrote
> 
> Philip,
> 
> Thanks for your response.  I reinstalled octave from the visualstudio .exe
> installer package, this time I installed java from the source forge
> dropdown list during installation.
> 
> When I ran Octave for the first time, I checked the pkg list, java was
> installed but not loaded.
> 
> I then setenv ("JAVA_HOME") and pkg load java.
> 

1. setting JAVA_HOME is only needed when you install the Java package
yourself (from source). No need to do this with the visualstudio Octave
installer because it contains a pre-compiled version.

2. In Octave, simply do
  pkg rebuild -auto java io
and after that you don't need to load them again manually.



> Next step was to javaaddpath to the POI and jxl interfaces.
> 

Instead of invoking a separate javaaddpath call to every POI, JXL, ... java
class lib, you can do (in Octave) chk_spreadsheet_support
("/path/where/you/put/the/jars")
chk_spreadsheet_support would also have told you whether the Java package
works. 

Advice: "/path/where/you/put/POI/jars" could be
<octave_install_dir>/lib/java/
<octave_install_dir> is what you get when you enter (in Octave) OCTAVE_HOME

In the io package there's a PKG_ADD file which should invoke
chk_spreadsheet_support automatically, but due to interference with the Java
package (more specifically, the package load order) this doesn't work
reliably. I'm presently looking into this.



> I them ran javamem and got results.
> 
> I have not checked all functionality but xlsread is working fine so I am
> happy.
> 

If you have Excel installed, chances are that the Java package doesn't make
a difference with the Octave MSVisualC binary.
That seems to automatically load the Windows package (which implements the
COM interface), so it would be the COM interface (which invokes Excel
directly) which makes xlsread work in your case.
(No problem IMO; the COM interface is many many times faster than the
Java-based interfaces.)



> If I did not wish to reinstall what is the best solution.
> 
> uninstall java pkg
> 
> setenv ("JAVA_HOME","location")
> 
> install and load java pkg
> 
> if I get octave.jar is not detected what do i do next
> 
> I know it has something to do with javaaddpath or javaaddclass
> 

Hopefully I understood it all OK (no worries, I'm no native English speaker
either).

Once again, octave.jar is part of the Java package itself. It does not need
to (read: must not) be added manually to the javaclasspath using javaaddpath
because it is implicitly included in the static javaclasspath.
If you see messages about missing octave.jar, it simply means that the Java
package is mis-installed.
Your only hope would be to reinstall the Java package with a proper
JAVA_HOME setting.
As to JAVA_HOME:
- Enter the path with *forward* slashes, also on Windows
AFAIK:
- On Windows it should be set such that <JAVA_HOME>/jre/lib/i386 contains a
file "jvm.cfg"
- On *nix such that <JAVA_HOME>/jre/lib/<arch>/client contains file
"libjvm.so"
- On Mac OSX I have no clue. Anyone?

Currently I'm busy amending the Java package to check the JAVA_HOME setting
before any installation action is performed. Hopefully that'll help to avoid
silently failing Java package installations, resulting in half baked and
non-functional Java package.

Philip


--
View this message in context: 
http://octave.1599824.n4.nabble.com/Problem-with-java-package-and-xlsread-tp4630893p4630911.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]