|
-
July 14th, 2004, 10:03 AM
#1
Setting file type to open in WebStart Program (Opened file as parameter)
Hi --
I've created a Java program & installed in on my PC using Web Start. Now I'd like set all .sit files to automatically open in my program. My program expects a file as input, and I'd like the opened .sit file to be that parameter.
I've tested this using a batch file to run the program (instead of Web Start), and that worked fine. I'm not able to get this to work with a Web Start program, though.
I opened My Computer & went to Tools / Folder Options / File Types. I created an SIT extention, and I tried a number of things:
- I had Web Start place a shortcut on the desktop, and then I selected that shortcut from the list in the File Types window --> I got a "TooManyArgumentsException" when I double-clicked on the .sit file.
- I tried to set the File Types setting to http://myserver/myapp.jnlp. --> Windows recognized that this wasn't an executable & wouldn't let me save it.
- I created a shortcut to http://myserver/myapp.jnlp and pointed the File Types setting to that. --> Windows wouldn't let me save that.
- I clicked the Advanced button on the File Types tab, and created an open action. I tried the same three things there & got the same results.
Is it possible to do what I'm trying to do (force .sit files to open in my Java Web Start program and send their filename into the program's main method as a parameter)? Does anyone have any pointers?
Thanks,
Bonnie
-
July 14th, 2004, 11:54 AM
#2
http://java.sun.com/j2se/1.5.0/docs/...s.html#options
-open <arguments>
This command line option says it replaces the argument tag in the jnlp file so you might need a blank argument tag in there.
I'm guessing now but the shortcut would be something like:
"c:\pathtojava\javaws\javaws.exe -open" "%1" "myjava.jnlp"
-
July 14th, 2004, 03:22 PM
#3
Thanks very much for the website & the idea. I've been trying that out on the command line, but I'm still getting the same errors. I've been trying this (with variations of the order & quotes):
C:\j2sdk1.4.2_04\jre\javaws\javaws.exe -open "C:\Documents and Settings\bks\Desktop\printfile_subcode.sit" http://yukon.ais.unc.edu:7777/SISWal...lueChecks.jnlp
I get this error:
An error occurred while launching/running the application.
Category: Invalid Argument error
Too many arguments supplied: {-open, C:\DOCUME~1\bks\LOCALS~1\Temp\javaws6, http://yukon.ais.unc.edu:7777/SISWal...lueChecks.jnlp }
I added a dummy argument to my JNLP file, as you recommended also.
Thanks for the idea. I'm still messing with this -- let me know if you think of anything else.
Thanks,
Bonnie
-
July 14th, 2004, 06:24 PM
#4
Well I should have looked at the link before I posted. It seems like the -open command will be out in version 1.5. I thought I saw a link to the beta 1.5 site on the webstart main page. Sorry. You could develop for that for now and require users to get the 1.5 beta, it will be standard at some date because this seems like a reasonable request even if the scenario is not mainstream webstart material. I could find no other clean solution with version 1.4 that doesn't require dynamic jnlp file creation and some cache handling.
One other thing I noticed is that you are doing something with a printer driver. I have no printer hooked up so I received a few annoying popups from the Windows system. There may be an exception you need to catch to avoid this for users without printers.
-
July 14th, 2004, 07:26 PM
#5
Thanks very much! I didn't think to check the version.
This program is a printing program -- that's its purpose, so it's okay that you got that error.
I'm going to look into the beta version & see how that goes.
Thanks very much for your help.
-- Bonnie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|