1function jmtPath = jmtGetPath
4% Copyright (c) 2012-2026, Imperial College London
7% Get path to common folder
8% This function
is at dev/src/solvers/JMT/jmtGetPath.m
9% Navigate up to the line-dev.git root directory
10current_dir = fileparts(mfilename(
'fullpath')); % dev/src/solvers/JMT
11root_dir = fileparts(fileparts(fileparts(fileparts(current_dir)))); % line-dev.git
12common_dir = fullfile(root_dir,
'common');
13jmt_jar = fullfile(common_dir,
'JMT.jar');
15if exist(jmt_jar,
'file')
18 line_printf('\nJava Modelling Tools cannot be found. LINE will try to download the latest JMT version (download approx. 50MB).\n')
22 line_printf('\nDownload started, please wait - this may take several minutes.')
23 if exist('websave')==2
24 % Check if file exists but
is locked/permission issue
25 if exist(jmt_jar, 'file')
26 fprintf('JMT.jar already exists at %s, attempting to use existing file.\n', jmt_jar);
31 % Ensure common directory exists
32 if ~exist(common_dir, 'dir')
37 outfilename = websave(jmt_jar, jmt_url);
38 line_printf('\nDownload completed. JMT jar now located at: %s',outfilename);
40 line_error(mfilename,'The MATLAB version
is too old and JMT cannot be downloaded automatically. Please download https:
44 if exist(jmt_jar, 'file')
47 error_msg = sprintf('Failed to download JMT: %s\nPlease manually download https:
48 line_error(mfilename, error_msg);
51 error_msg = sprintf('Java Modelling Tools was not found. Please download https:
52 line_error(mfilename, error_msg);