newLISP Fan Club

Forum => newLISP Graphics & Sound => Topic started by: iNPRwANG on January 04, 2018, 01:36:16 AM

Title: Guiserver can not load internal image under jre 9.0.1
Post by: iNPRwANG on January 04, 2018, 01:36:16 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 ?
Title: Re: Guiserver can not load internal image under jre 9.0.1
Post by: iNPRwANG on January 09, 2018, 05:31:57 PM
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));

      }
Title: Re: Guiserver can not load internal image under jre 9.0.1
Post by: Lutz on January 10, 2018, 09:46:24 AM
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/
Title: Re: Guiserver can not load internal image under jre 9.0.1
Post by: iNPRwANG on January 10, 2018, 04:23:34 PM
Thanks, Lutz.