what I'm asking is how to make any associated file type open my program with the corresponding data. For example, if you have a .doc file it opens Microsoft word with whatever is saved to that file. I know how to associate the file extension to my program, but it just opens the program from the location of the file. How do I make the program read the file upon start-up?
You make the program accept command-line arguments. When you open something from Explorer, it passes the name(s) of the item(s) you clicked on as command-line arguments. Your program must take these command-line arguments and do whatever processing is required... including opening and reading the contents.
In C/C++, these are the
argv arguments in
int main(int argc, char *argv). In Java, it's the args in
public static void main(String args). In other languages, you'll have to look into it.
Since this is Java and a desktop app., the obvious solution would be Java Web Start.
JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..
Here is a demo. of the file services that associates the type
.zzz with the demo. Double click such a file and it will open in the app.