Requirements to use functions from my own jar file

7 views (last 30 days)
Martin Schätz
Martin Schätz on 16 Oct 2015
Hi, I am trying to use my java functions in Matlab. I know how to add jar file to Matlab path. I know that I am supoused to put constructor in my java class (I don't know why, but MatLab cannot find it without constructor). And even with the constructor I am not able to call my functions if they are in some packege. It works only when placed in default package, when the class file is in root of the jar file.
clear all, close all, clc
%Check if it is added
%%a. Call Public Static Functions of the Class
% Public static functions of a Java class can be called without having to create an instance of that class.
TestFunction.main('') % Call public static functions of the HelloWorld class
%%b. Create an Instance of the Class
% To create an instance of my class, issue the following command at the MATLAB command prompt:
instance = TestFunction % Create an instance of the class through the constructor
%%c. Call method of the Class
  • Am I making something wrong with my java code or jar export?
  • Is there a way to use classes if they are in package(s)?

Answers (0)



Community Treasure Hunt

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

Start Hunting!