[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60058] Feature request: function javaversion(
From: |
Ernst Reissner |
Subject: |
[Octave-bug-tracker] [bug #60058] Feature request: function javaversion() |
Date: |
Sun, 14 Feb 2021 16:24:11 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0 |
URL:
<https://savannah.gnu.org/bugs/?60058>
Summary: Feature request: function javaversion()
Project: GNU Octave
Submitted by: ernstreissner
Submitted on: Sun 14 Feb 2021 09:24:09 PM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: Reissner
Originator Email:
Open/Closed: Open
Release: dev
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
I think one needs a function displaying the version
of the java virtual machine JVM.
This is very simple to do:
%% -*- texinfo -*-
%% @deftypefn {Function File} {@var{res}} javaversion()
%%
%% Returns the java version as a string
%% of the form @code{major.minor.update-patch}.
%%
%% @example
%% javaversion()
%% @end example
%%
%% @end deftypefn
function str = javaversion()
v = javaMethod("version", "java.lang.Runtime");
str = [num2str(v.feature()) "." num2str(v.interim()) "." num2str(v.update())
"-" num2str(v.patch())];
endfunction
This allows also to check versions:
v = javaMethod("version", "java.lang.Runtime");
v11 = javaMethod("parse", "java.lang.Runtime$Version", "11.3.2.3");
v16 = javaMethod("parse", "java.lang.Runtime$Version", "16.1.0.1");
printf("versions this to max %d, this to min %d"
,v.compareTo(v16),v.compareTo(v11))
a.compareTo(b) >=0 iff a >= b and so on.
This allows to check java versions
in the context of package loading.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60058>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(),
Ernst Reissner <=
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Ernst Reissner, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Philip Nienhuis, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Markus Mützel, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Ernst Reissner, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Markus Mützel, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Markus Mützel, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Ernst Reissner, 2021/02/15
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Markus Mützel, 2021/02/16
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Ernst Reissner, 2021/02/16
- [Octave-bug-tracker] [bug #60058] Feature request: function javaversion(), Markus Mützel, 2021/02/16