Guiserver can not load internal image under jre 9.0.1

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE

Guiserver can not load internal image under jre 9.0.1

Postby iNPRwANG » Thu Jan 04, 2018 9:36 am

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

Postby iNPRwANG » Wed Jan 10, 2018 1:31 am

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));
}
iNPRwANG
 
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

Re: Guiserver can not load internal image under jre 9.0.1

Postby Lutz » Wed Jan 10, 2018 5:46 pm

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/
Lutz
 
Posts: 5254
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Guiserver can not load internal image under jre 9.0.1

Postby iNPRwANG » Thu Jan 11, 2018 12:23 am

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


Return to newLISP Graphics & Sound

Who is online

Users browsing this forum: No registered users and 0 guests

cron