3

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());

jacandau
  • 197
  • 1
  • 12

1 Answers1

2

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

Stuart Rossiter
  • 2,432
  • 1
  • 17
  • 20