octave-maintainers
[Top][All Lists]
Advanced

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

Re: usejava.m


From: Philip Nienhuis
Subject: Re: usejava.m
Date: Tue, 07 Feb 2012 22:16:18 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Rik wrote:
  On 02/04/2012 08:54 AM, address@hidden wrote:

 Date: Fri, 3 Feb 2012 15:29:06 -0800 (PST)
 From: PhilipNienhuis <address@hidden>
 To: address@hidden
 Subject: usejava function
 Message-ID: <address@hidden>

2/6/12

Philip,

I added the function usejava(). It is entirely a stub and returns false
since core Octave does not support Java. It was mainly a gesture towards
compatibility. My guess is that most Matlab programs either use Java
features or don't use Java features, but probably very few of them have
coded up tests to check with usejava() and then implement an alternative.

If you want to improve the function please go ahead. I think either
approach you outlined is fine. I had been assuming something like your
second approach which is a C++/inheritance way of thinking. In this way
of thinking, the core defines a function but the behavior can be
overloaded or modified by a subclass. In this case, core Octave does not
support Java but if someone has installed a package, like the
Octave-Forge one, that did add support for some functionality then it
could overload usejava and tell users which features it supported.

I do know how freaked people get when they see a warning message so if
you want to adopt approach #1 that is also good.

OK, for approach #1 a changeset is attached.

I looked at the tests but it is a bit beyond me to devise a reliable test that would invoke the Java package. As it stands, the tests would only be usable in a "make check" session right after building Octave. But fortunately, the "desktop" feature test should always return false anyway as Octave doesn't have a Java-based desktop GUI.

Transcript from an Octave-3.6.0 session with openjdk:

========================================================
address@hidden ~]$ ls /usr/lib/jvm
java@ java-1.6.0-openjdk@ java-openjdk@ jre-1.6.0@ jre-openjdk@
java-1.6.0@  java-1.6.0-openjdk-1.6.0.0/  jre@           jre-1.6.0-openjdk@
address@hidden ~]$ octave
GNU Octave, version 3.6.0
Copyright (C) 2012 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "i686-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.

For information about changes from previous versions, type `news'.

octave:1> pkg list
Package Name  | Version | Installation directory
--------------+---------+-----------------------
          io *|  1.0.16 | /usr/local/share/octave/packages/io-1.0.16
        java *|   1.2.8 | /usr/local/share/octave/packages/java-1.2.8
octave:2> usejava ("awt")
ans =  1
octave:3> usejava ("desktop")
ans = 0
octave:4> usejava ("swing")
ans =  1
octave:5> usejava ("jvm")
ans =  1
octave:6> pkg unload java
octave:7> usejava ("awt")
ans = 0
octave:8> usejava ("swing")
ans = 0
octave:9> usejava ("desktop")
ans = 0
octave:10> usejava ("jvm")
ans = 0
octave:11>
========================================================

Philip

Attachment: usejava.patch
Description: application/download


reply via email to

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