Guiserver can not load internal image under jre 9.0.1

Started by iNPRwANG, January 04, 2018, 01:36:16 AM

Previous topic - Next topic

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

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


Quote
   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

Thanks for fixing this. There is a new guiserver.jar version 1.67 and upated source package here:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/

iNPRwANG

Thanks, Lutz.