Please let me know how to run / invoke .dmg application in Java.
I used below syntax
Runtime.getruntime.exec("sample.dmg")
but it throws an error as “permission denied” with error code 13. Please let me know how to invoke dmg.
Please let me know how to run / invoke .dmg application in Java. I
Share
You should use
Desktop.open(File file)which will use the appropriate opener for the OS. In your case on a Mac it will useopen. This is better thanRuntime.execas you’re not relying the exact location of theopencommand. Furthermore, this would even work on Windows if it had a DMG mounting application, such as Mediafour’s MacDrive.The bottom line is use
Desktop.open(File file)to open a file with the operating system’s default opener, that’s what it’s there for. Most people only useRuntime.execas a last resort.