I have two computers. Computer A has matlab on and I use to write GUI's and then compile them. Computer B has hardware attached and 3rd party open source software. In order to allow matlab to run the 3rd party, I need to add a few jar files to the class path. Walter has kindly showed me to use e.g.:
javaaddpath(C:/Micro-Manager-1.4/plugins/Micro-Manager/MMCoreJ.jar','-end')
But, my Computer A does not have these jar files on, these belong only on Computer B. Computer B also does not have matlab, but does have the MCR, so I want to use computer A to compile my matlab GUI to run on computer B, but to use the jar files from Computer B (associated with the open source program)
So does using the code above, on Computer A (where there are no jars), allow my GUI, when compiled and run on computer B to include these jars. Is there a better way to ensure the compiled code has access to the jars?
Sorry if this is confusing.
Thanks Jason

 Akzeptierte Antwort

Dasharath Gulvady
Dasharath Gulvady am 28 Sep. 2015
Bearbeitet: Dasharath Gulvady am 28 Sep. 2015

0 Stimmen

Jason,
You may achieve this by adding the JAR file only for compiled applications, which can be done using "isdeployed" as follows:
if isdeployed
javaaddpath('C:/Micro-Manager-1.4/plugins/Micro-Manager/MMCoreJ.jar','-end')
end
This makes sure that the JAR file is added in machine B and not in machine A.

6 Kommentare

Jason
Jason am 28 Sep. 2015
Hmmm. It doesn't like the last end command:
Illegal use of reserved keyword "end".
Dasharath Gulvady
Dasharath Gulvady am 28 Sep. 2015
Could you double check the syntax to make sure the arguments are enclosed in single quotes? Also, does it work as expected without using '-end'?
Jason
Jason am 28 Sep. 2015
Yes this now works:
if isdeployed
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/MMCoreJ.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/MMAcqengine.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/MMJ_.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/clojure.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/bsh-2.0b4.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/swingx-0.9.5.jar','-end');
javaaddpath('C:/Program Files/Micro-Manager-1.4/plugins/Micro-Manager/swing-layout-1.0.4.jar','-end');
end
Thankyou
Jason
Jason am 28 Sep. 2015
Is it possible to add them (or include them) as its compiling so there is no need for them on the target PC?
Dasharath Gulvady
Dasharath Gulvady am 28 Sep. 2015
Yes, you can include those JARs by using "Files required for your library to run" option in deploytool. Note that, once you add, you can simply assume that the included JARs are in the current folder (no absolute path for the JARs are required)
Jason
Jason am 29 Sep. 2015
Do you mean "Files Required for your application to run" as I am making a standalone .EXE

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Compiler finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Sep. 2015

Kommentiert:

am 29 Sep. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by