I have a program in which I have used a .myFileType file. obviously windows does not recognise the file type and so I have to browse for the file in the application.

how do I make it so that windows knows .myFiletype's native application and launch the application on double clicking the file?

Any direction or help would be appreciated!

Thanks

Recommended Answers

All 7 Replies

Ask about mime types and file associations at an MS forum.

So I take it from your response that there is no standard way that Java programmers get around this? I will try a MS forum but usually you get stupid answers like "That's why I use C#" which is not helpful.

Thanks anyway.

That is why I told you to ask specifically about "mime types" and "file associations". You don't have to even get into what language you used to write the application. That is irrelevant. You simply want to now about an OS specific feature, so ask about that feature on a forum for the OS involved.

Thank you, I am looking into that now :) was just venting about some of the responses one tends to get in anti-java forums. no offence intended. your help is appreciated!

This is an OS issue, nothing to do with java programming.
On Windows the filetypes are associated with commands by entry in the registry.
The easy user interface to add your own filetype is through Windows Explorer (98 & XP)
Use menu item: Tools|Folder Options|File Types. Click New and fill in the blanks.

Thanks NormR1. I did try this as the first port of call but it throws an exception stating that the application is not a valid Win32 application. like I said before, I know it is not Java programming but who better to ask how to make a Java Program do something than Java Programmers who might have had occasion to do so before.

if I find the solution I will post it here.

Before putting the command line into the registry, try it in a command prompt to make sure its right.
Here's an export from my registry for a filetype I added: RSS
See the entry for Open\Command

[HKEY_CLASSES_ROOT\RSSfile\Shell\Edit]

[HKEY_CLASSES_ROOT\RSSfile\Shell\Edit\command]
@="\"C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe\" \"%1\""

[HKEY_CLASSES_ROOT\RSSfile\Shell\Edit\ddeexec]

[HKEY_CLASSES_ROOT\RSSfile\Shell\Edit\ddeexec\Application]
@="Wordpad"

[HKEY_CLASSES_ROOT\RSSfile\Shell\Edit\ddeexec\Topic]
@="System"

[HKEY_CLASSES_ROOT\RSSfile\Shell\Open]

[HKEY_CLASSES_ROOT\RSSfile\Shell\Open\command]
@="java.exe -Xmx128m -cp D:\\JavaDevelopment\\runtime\\SlideShowApp.jar SlideShow.ImgIdxEditor -i \"%1\""

[HKEY_CLASSES_ROOT\RSSfile\Shell\Open\ddeexec]

[HKEY_CLASSES_ROOT\RSSfile\Shell\Open\ddeexec\Application]
@="Java"

[HKEY_CLASSES_ROOT\RSSfile\Shell\Open\ddeexec\Topic]
@="System"

[HKEY_CLASSES_ROOT\RSSfile\Shell\SetDates]

[HKEY_CLASSES_ROOT\RSSfile\Shell\SetDates\command]
@="C:\\BatchFiles\\SetDates.bat \"%1\""

[HKEY_CLASSES_ROOT\RSSfile\Shell\SetDates\ddeexec]

[HKEY_CLASSES_ROOT\RSSfile\Shell\SetDates\ddeexec\Application]
@="java"

[HKEY_CLASSES_ROOT\RSSfile\Shell\SetDates\ddeexec\Topic]
@="System"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.