Page 1 of 1

Guiserver can not load internal image under jre 9.0.1

PostPosted: Thu Jan 04, 2018 9:36 am
by iNPRwANG
OS version is win10 x64 1709 (Chinese simplified).

After I upgraded Jre from 8.x to 9.0.1, and running any newLisp script that used guiserver(such as the widgets-demo.lsp), all of the program that use the internal image (such as gs:image-button that use a image "/local/newLISP32.png") will cause a error message. And, the program will finally startup and show the main interface with not any image.

I am not good at Java, I can not delimit is it a incompatible changes by Jre 9.x ?

Re: Guiserver can not load internal image under jre 9.0.1

PostPosted: Wed Jan 10, 2018 1:31 am
by iNPRwANG
I'v tried to traced into guiserver, and found that the "cls.getClass().getResource()" call get a null point result in Jre 9.0.1, I changed the code to "cls.getResource()" and the result is corrected.

The code looks like this:

guiserver.java:180

public static Image getImageFromPath(String path, Class cls)
{
if(path.startsWith("/local/")) {
return(Toolkit.getDefaultToolkit().getImage(cls.getResource("/images" + path.substring(6))));
//return(Toolkit.getDefaultToolkit().getImage(cls.getClass().getResource("/images" + path.substring(6))));
}
else
return(Toolkit.getDefaultToolkit().getImage(path));
}

public static ImageIcon getIconFromPath(String path, Class cls)
{
if(path.startsWith("/local/"))
//return(new ImageIcon(Toolkit.getDefaultToolkit().getImage(cls.getClass().getResource("/images" + path.substring(6)))));
return(new ImageIcon(Toolkit.getDefaultToolkit().getImage(cls.getResource("/images" + path.substring(6)))));
else
return(new ImageIcon(path));
}

Re: Guiserver can not load internal image under jre 9.0.1

PostPosted: Wed Jan 10, 2018 5:46 pm
by Lutz
Thanks for fixing this. There is a new guiserver.jar version 1.67 and upated source package here:

http://www.newlisp.org/downloads/develo ... nprogress/

Re: Guiserver can not load internal image under jre 9.0.1

PostPosted: Thu Jan 11, 2018 12:23 am
by iNPRwANG
Thanks, Lutz.