Guiserver can not load internal image under jre 9.0.1

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

Guiserver can not load internal image under jre 9.0.1

Post 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 ?

iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

Re: Guiserver can not load internal image under jre 9.0.1

Post 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));
}

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Guiserver can not load internal image under jre 9.0.1

Post 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/

iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

Re: Guiserver can not load internal image under jre 9.0.1

Post by iNPRwANG »

Thanks, Lutz.

Locked