필터 지우기
필터 지우기

Compiling a Matlab function with a Java library dependency

조회 수: 6 (최근 30일)
Tommy
Tommy 2023년 9월 27일
댓글: Tommy 2023년 9월 29일
I want to convert an existing matlab function (lets call it foo.m) to a java library using the compiler toolbox.
However, foo() uses multiple recursive calls to an existing java library (lets call it bar.jar) to compute its results.
My questions are:
  1. Is this a use case the compiler toolbox can handle (the documentation seems to imply only a single entry point)?
  2. During compilation, would bar.jar be considered an external dependency or will it be embedded in the resulting foo.jar?
Dependencies prevent me from easily translating foo.m to Java, so I would appreciate thoughts about this.
  댓글 수: 1
Tommy
Tommy 2023년 9월 29일
After a few days of tinkering, I have tentative answers to the above:
  1. The compiler toolbox seems to have no issue with calling libraries using the standard javaaddpath() and import commands. I found that specifying a relative path to the library was the cleanest way to do this easily.
  2. The external library does not need to be included as an explicit dependency in the compiler app, and does not seem to be included automatically in the compiled jar. You can do this and it still works, but you don't have to.
Hope this is helpful to someone other than myself.

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

답변 (0개)

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by