Mercurial > hg > octave-lojdl
changeset 15805:420b5603cbbf
build: Move usejava.m from scripts/miscellaneous to scripts/java directory.
* scripts/java/module.mk: Add usejava.m to build system.
* scripts/java/usejava.m: Added m-file.
* scripts/miscellaneous/module.mk: Remove usejava from miscellaneous directory build.
* scripts/miscellaneous/usejava.m: Removed m-file.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 17 Dec 2012 10:16:08 -0800 |
parents | b15cfb7ed0eb |
children | 01d4f742d75d |
files | scripts/java/module.mk scripts/java/usejava.m scripts/miscellaneous/module.mk scripts/miscellaneous/usejava.m |
diffstat | 3 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/java/module.mk +++ b/scripts/java/module.mk @@ -13,6 +13,7 @@ java/listdlg.m \ java/msgbox.m \ java/questdlg.m \ + java/usejava.m \ java/warndlg.m FCN_FILES += $(java_FCN_FILES)
rename from scripts/miscellaneous/usejava.m rename to scripts/java/usejava.m --- a/scripts/miscellaneous/usejava.m +++ b/scripts/java/usejava.m @@ -38,11 +38,11 @@ ## @end table ## ## @code{usejava} determines if specific Java features are available in an -## Octave session. This function is provided for compatibility with scripts -## which may alter their behavior based on the availability of Java. The -## feature "desktop" always returns @code{false} as Octave has no Java-based -## desktop. Other features may be available if the Octave-Forge Java package -## has been installed. +## Octave session. This function is provided for scripts which may alter +## their behavior based on the availability of Java. The feature "desktop" +## always returns @code{false} as Octave has no Java-based desktop. Other +## features may be available if Octave was compiled with the Java Interface +## and Java is installed. ## @end deftypefn function retval = usejava (feature) @@ -54,22 +54,22 @@ retval = false; switch feature - ## For each feature, try javamethods() on a Java class of a feature + ## For each feature, try methods() on a Java class of a feature case "awt" try - dum = javamethods ("java.awt.Frame"); + dum = methods ("java.awt.Frame"); retval = true; end_try_catch case "desktop" ## Octave has no Java based GUI/desktop, leave retval = false case "jvm" try - dum = javamethods ("java.lang.Runtime"); + dum = methods ("java.lang.Runtime"); retval = true; end_try_catch case "swing" try - dum = javamethods ("javax.swing.Popup"); + dum = methods ("javax.swing.Popup"); retval = true; end_try_catch otherwise @@ -81,6 +81,9 @@ %!assert (usejava ("desktop"), false) +%!testif HAVE_JAVA +%! assert (usejava ("jvm"), true); + %% Test input validation %!error usejava () %!error usejava (1, 2)