Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Anylogic Model Path in Disk Programmatically

Tags:

anylogic

How can you get a Path - String - File reference to where the Anylogic model is located in the disk from one of the Java code input windows?

I fear it might not be possible because the execution takes place from a produced BUILD folder that contains the classes generated by AL, but there might be a way to pass this information down through a variable for it to be available at runtime...

So far I have only managed to get the folder where this classes produced by AL are located by doing (from the main agent):

traceln(this.getClass().getProtectionDomain().getCodeSource().getLocation());

like image 508
jacandau Avatar asked Feb 23 '26 20:02

jacandau


1 Answers

Just use System.getProperty("user.dir"), since the ALP file's location is the working directory for the model as a Java application.

like image 165
Stuart Rossiter Avatar answered Feb 26 '26 10:02

Stuart Rossiter