MASON-INTEREST-L Archives

April 2022

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version:
1.0 (Mac OS X Mail 11.5 \(3445.9.7\))
Content-Type:
multipart/alternative; boundary="Apple-Mail=_ABBBF067-32A6-4E6D-9785-42F1FA965649"
Date:
Fri, 29 Apr 2022 10:17:25 -0400
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Message-ID:
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (3310 bytes) , text/html (9 kB)
They're in the resources directory.

Some history.  Originally MASON was set up with one single directory containing source files and appropriate resource files (images etc.) right in their spots.  You'd just put that one directory in your CLASSPATH.  You'd compile your java files to class files, which would be right next to the java files (and the resource files), and when you ran it everything would be fine.

The problem with this was that various IDEs, and later Maven, insisted that source, target (.class), and resource files must be in separate directories.  This nonsense stemmed from more primitive compilation and build systems dating from C and C++.  So we tweaked MASON's build system to have separate directories, but eventually merge the class files and the resource files, then jar them up together.  Frankly I'd like to undo all this.

My suggestion is that if you don't need to *build* MASON -- just use it -- then you should just use the mason jar file rather than the source distro.  You can build your models against the jar file, it's all put together for you.

Sean

> On Apr 29, 2022, at 9:18 AM, Jonathan M West <[log in to unmask]> wrote:
> 
> Actually I just searched the source directory and I can’t find the image files anywhere
>  
> From: MASON Multiagent Simulation Toolkit <[log in to unmask]> On Behalf Of Sean Luke
> Sent: Friday, April 29, 2022 7:35 AM
> To: [log in to unmask]
> Subject: Re: Problems running tutorial in manual
>  
> The Console class grabs a couple of images, such as the play, stop, and pause icons, when it is fired up.  These icons are ultimately stored right next to the Console.class file.  Console looks them up like this:
>  
>               Console.class.getResource("Play.png")
>  
> If the image is missing, then this expression will return null and you'll get this error I'm guessing.
>  
> What might be the cause?  Probably a build error.  Due to Maven (ugh) MASON presently has all of its resources, including the images, stored in a different directory than its java files.  When you build MASON it needs to merge them the image directory with its class directory so they're located in the right spot.  If you build using the Makefile it'll do this right: if you build using Maven it'll also do it right.
>  
> That's all I've got: hopefully this will be enough of a clue.
>  
> Sean
>  
> On Apr 28, 2022, at 11:20 PM, Jonathan M West <[log in to unmask] <mailto:[log in to unmask]>> wrote:
>  
> I keep getting this error message for StudentswithUI.java as implemented in the manual
>  
> Exception in thread "main" java.lang.ExceptionInInitializerError
>               at myMasonTest.StudentsWithUI.main(StudentsWithUI.java:17)
> Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
>               at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:234)
>               at sim.display.Console.iconFor(Console.java:173)
>               at sim.display.Console.<clinit>(Console.java:176)
>               ... 1 more
>  
> I’ve searched all over for a solution to this and haven’t found one in the listserv, it is obviously a configuration problem but I do not know what is incorrectly configured
>  
> Jon West



ATOM RSS1 RSS2