How do I open a file with the default associated program in Java? (for example a movie file)
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Here you go:
Create a different class within the package:
You can use
Desktop.getDesktop().open(File file)
. See the following question for other options: "[Java] How to open user system preffered editor for given file?"SwingHacks has a solution for older versions of Java.
I think they used the Runtime object to execute the 'start' command on windows and there is a similar command on the mac.