Posts

Showing posts from June, 2012

How to create a file association for Java Applet (in Windows)?

Everybody says that Java applets are dead (and there are talks to revive them with JavaFX 2). But it seems they are still not dead, at least from my point of view - since I maintain an applet for one of my customers. Basically, that applet processes .svg  files. And it would be convenient for user just to do double-click on a file and get the applet to start with that file. I solved this problem as follows: applet accepts a parameter in it's launch url, and file association in Windows launches Internet Explorer with the file name as parameter in that url. Here's the code to establish such file association: assoc .svg=SvgGraphicsFile ftype SvgGraphicsFile=C:\Program Files\Internet Explorer\iexplore.exe "www.someplace.ru/index.html?file=" "%1" And this is how I extracted that file name from applet url: // first, in our Applet class, we get the url, from which app was launched val docBase = getDocumentBase() // then, we parse it object Loader { def lo