association : Java Glossary


In SQL (Standard Query Language), a many to many relationship between tables. In windows, a hare-brained scheme to associate file name extensions with the applications that process them. It is hard to use, buggy and irregular beyond belief.
The associations for *.jar and *.jnlp are fragile. They mysteriously change to obsolete versions, or javaw.exe version without a console or even unrelated programs like Winzip.exe. Using the java.exe -jar myjar.jar syntax in your bat/btm files rather is more robust than myjar.jar. It works even when the associations are corrupted.

To set up common associations in Windows Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 click Start ⇒ Default Programs ⇒ set your default programs . You can then type Choose defaults for this program to make fine associations. You might try out the Creative Element Power Tools to handle configuring all the associations and the icon. To set up rarer associations in Windows  Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 click Start ⇒ Default Programs ⇒ Associate a file type or protocol with a program

To set up associations in Windows W2K and XP click Start ⇒ Settings ⇒ Control Panel ⇒ Folder Options ⇒ File Types. See the more detailed instructions on setting up the *.jnlp association. In Windows  W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 you can now sort the list by extension or filetype by clicking on the heading. You commonly set up edit for example to use your editor in preference to WordPad for a given extension, e.g.

E:\vslick\win\vs.exe %1
The quote marks help deal with filenames containing spaces. The %1 is where the filename to edit will be inserted.

There are also another set of associations in your browser between extensions, MIME (Multipurpose Internet Mail Extensions) types and programs to deal with those documents.

java.exe vs javaw.exe

One of the most useful associations to set up is to make *.jar files executable with java.exe. Then you can just type the name of the jar on the command line to start it executing.
If you use javaw.exe rather than java.exe you won’t see the console output. Watch out, Java installers often associate *.jar files with javaw.exe instead of java.exe, overriding your setting. Every time you install a new Java version, the installer will replace your association to java.exe to a brain damaged javaw.exe that hides all the output.

Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 no longer lets you configure the all the associations, e.g. open, edit and print. There used to be a way around that, using Creative Element Power Tools but it is no longer available. If you are brave, you can manually modify the registry.

See making jar files executable and double clickable for details on how to set up the association.

In W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64, there is a quick way to set up associations. You just type a filename complete with extension. Windows will complain it does not know what program is supposed to process the file. You then select the associated program from a list or browse for it. From then on Windows remembers the association. Unfortunately, that mechanism is not smart enough to set up the java.exe -jar link.

There are two old built-in cmdline tools ASSOC and FTYPE or the combined tool associate available here or here. They now come built-in with W10-32 and W10-64. In theory, this should work to set up the java.exe -jar link. but it does not. If you can see my error below, please let me know.

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number