Environment variables in javaclasspath.txt

조회 수: 4 (최근 30일)
Xeozim
Xeozim 2019년 2월 5일
댓글: Yair Altman 2019년 2월 13일
Hi,
I was whether the functionality for modifying the static path via javaclasspath.txt has any compatibility with environment variables.
I can't post code for security reasons, but I have to change a bunch of paths when I install a new version of the java software (delivered from another team), and I'm trying to eliminate as many of these as possible by referencing environment variables so I can just change one of them when the software is updated.
At the moment I have something like this in javaclasspath.txt
D:\somepath\version_number\subpath\to\file.jar
I wasn't sure if the windows syntax
%MY_ENV_VAR%\subpath\to\file.jar
would work, or maybe internal MATLAB syntax
[getenv('MY_ENV_VAR') "subpath\to\file.jar"]
Thanks in advance.
Dave

채택된 답변

Yair Altman
Yair Altman 2019년 2월 11일
I do not believe that you can use env vars in your javaclasspath.txt file, but as workaround, you can programmatically load the necessary Java classes into the static Java classpath inside your Matlab code, as described in https://undocumentedmatlab.com/blog/static-java-classpath-hacks. Doing so enables you to programmatically set the path of the loaded classes.
  댓글 수: 2
Xeozim
Xeozim 2019년 2월 13일
Thanks Yair, love your website by the way!
Yair Altman
Yair Altman 2019년 2월 13일
Glad to hear it - spread the word :-)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Java Package Integration에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by