0

I want it like when we do "open with" and then choose Notepad. So that when I "open with" a file there will be my program in the list. How to associate a file type with my program?

How to make the program handle the file?

Captain Obvlious
  • 19,754
  • 5
  • 44
  • 74
robotmaker01
  • 107
  • 1
  • 6
  • If you mean, you want the OS to associate a file type and use your Java program to launch it, check out http://stackoverflow.com/questions/2043029/utilising-a-file-association-in-a-java-application – MadProgrammer Jul 30 '12 at 03:07
  • You could check out http://www.rgagnon.com/javadetails/java-0592.html I've not tried, but at least it seems promising. – MadProgrammer Jul 30 '12 at 03:11
  • I made extensive edits to the question, but it is still broad and confusing. Although there are two questions in the body, the question in the title makes for a 3rd. The Windows 'autoview/preview' is a separate matter again. What specific file extension do you have an interest in? Something common like .html or .txt, or a less 'known' type like .zzz or .quak? – Andrew Thompson Jul 30 '12 at 04:14

2 Answers2

1

Deploy the app. using Java Web Start.

Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation for platforms that support Java.

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..

This demo. of the file service is deployed using JWS (on OS X, *nix and Windows) and declares an interest in the .zzz file-type.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

Best thing would be to create an EXE wrapper for your Java program:

How can I convert my Java program to an .exe file?

and

Best free tool to build an exe from Java code?

are relevant. Then you would need to create a file association. See this KB article on how to do it manually: http://support.microsoft.com/kb/307859

If you use an installer package to package your app you would have to research on how to accomplish this automatically when your program installs.

Community
  • 1
  • 1
Strelok
  • 50,229
  • 9
  • 102
  • 115