次のコードを使用して、ランタイム コマンドを呼び出して Java で gif 画像を表示します。WindowsPhotoGallery が開きますが、画像は表示されません。代わりに、PC に他の画像がたくさん表示されます。私の質問は、渡す方法です。 gif画像ファイル名を適切に付けて、私の画像で開きます。
今、私は次のように渡しています: C:\Program Files\Windows Photo Gallery\WindowsPhotoGallery "C:/abc.gif"
どちらが間違っていますか、正しい方法は何ですか?
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(); }