Java/Windows Picture Viewer
I'm trying to open images in the Windows Fax and Picture viewer, but have run into a problem.
While this works:
Runtime.getRuntime().exec("rundll32.exe C:\\WINDOWS\\System32\\shimgvw.dll,ImageView_Fullscreen "
the finished program will be run from a DVD\CD, so I'll need to access the directory by using System.getProperty("user.dir").
After iterating along the string produced by that call, and creating a String Builder object by appending the extra '\'s and the file name and then converting that toString I get the finalString:
C:\\Eclipse\\Project1\\001.jpg. However, this: " Runtime.getRuntime().exec("rundll32.exe C:\\WINDOWS\\System32\\shimgvw.dll,ImageView_Fullscreen " finalString) doesn't work. What am I doing wrong?
First, you shouldn't need to append the extra \, that is only for literal Strings. E.g.
String s = "This is a backslash \\";
This is a backslash \
As far as why, what you have won't work, the only issue I see is that you don't have a + between the string literal and the finalString.
Also note that as usual your code won't work on a non-windows computer, or one where the Windows folder isn't on the C drive, or not called Windows.
You can show full screen images without having to use System.getRuntime().exec(...) though. E.g.