How do I use WindowsPhotoGallery to display a gif image from Java?

I am using the following code to display a gif image in Java, calling the runtime command, it opens WindowsPhotoGallery but does not display my image, instead it shows a bunch of other images on my PC, my question is how to pass the gif image filename correctly, so it will open with my image.

Now I am passing it this way: C: \ Program Files \ Windows Photo Gallery \ WindowsPhotoGallery "C: /abc.gif"

What's wrong, what's the correct way to do it?

String Command,Program,File_Path="C:/abc.gif";
Process process=null;

Program="C:\\Program Files\\Windows Photo Gallery\\WindowsPhotoGallery ";          
Command=Program+"\""+File_Path+"\"";

try { process=Runtime.getRuntime().exec(Command); }
catch (Exception e) { e.printStackTrace(); }

      

0


a source to share


2 answers


You can use Runtime.exec(String[] cmdArray)

to pass command and its arguments.



+1


a source


The problem is with the command line.



eg: c: \ document and setting \ pic.gif = "\" c: \ document and setting \ pic.gif \ ""

0


a source







All Articles