I use the following code to display a gif image in Java by calling a runtime command, it opens the WindowsPhotoGallery, but doesn't display my image, instead it shows a bunch of other pictures on my PC, my question is : how to pass the gif image file name to it properly, so it will open with my image.
Now I'm passing it like this : C:\Program Files\Windows Photo Gallery\WindowsPhotoGallery "C:/abc.gif"
Which is incorrect, what's the right 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(); }