Search code examples
anylogic

"main cannot be resolved" when creating a list


I wanted to create a list which can then be called up with a button. The list contains all agents (packages) which which are created by the source.

I can not get rid of the error message.

I checked that the variable packageList is public and I have tried to correct Chatgpt's suggestions for improvement. Anylogic screenshot


Solution

  • As I understand you are already in the main agent environment. So you do not need to call main here. Just change the code to :

    packageList.add(agent);