I want to know if it's possible to open a file in my program that is written in java just by doing a double click on the file?

For example:
On my desktop is a file "test.dat" that was built by my program. If I try to open this file my program shows up and asks me what I want to do with that file.

Is it possible to implement that feature using java?