Skip to content

Commit abfe336

Browse files
committed
greatly simplify
1 parent 7d8cbfc commit abfe336

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

+stdlib/java_api.m

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
%% JAVA_API Java API version
22

3-
function api = java_api()
3+
function a = java_api()
44

5-
api = [];
6-
7-
v = stdlib.java_version();
8-
if strempty(v), return, end
9-
10-
% major version is first number before "."
11-
12-
a = strsplit(v, '.');
13-
if(isempty(a)), return, end
5+
try
6+
a = javaMethod("getProperty", "java.lang.System", "java.specification.version");
7+
catch
8+
a = '';
9+
end
1410

15-
if a{1} == "1"
16-
api = str2double(a{2});
17-
else
18-
api = str2double(a{1});
11+
try %#ok<*TRYNC>
12+
a = string(a);
1913
end
2014

2115
end

0 commit comments

Comments
 (0)