The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


issues installing a java application on various flavors of windows

Posted by Bill Clark on December 13, 2001 at 9:56 AM

thanks matt!

this looks like our best route to avoid the bat file and command console. microsoft confirmed this morning that there is a 130 character limit for this entry in the windows NT registry because the UI component for editing the file association imposes that limit. no workaround.

> Here's what I'd do:

> I'd write a little Windows program in C/C++ that reads an INI file that looks something like this:

> [defaults]
> java=C:\Program Files\MyCompany\MyJRE\bin\javaw.exe
> java Params=-Xbootclasspath/p:"C:\Program Files\MyCompany\MyApp\boot.jar" -jar
> Java Target="C:\Program Files\MyCompany\MyApp\MyApp.jar"

> When you run the program it would appropriately assemble all the above, add any parameters that it was given and ShellExecute() the results.

> Note, this would not be console app, it would be a Windows app; that is, it would have a WinMain() entry point, not a main(). This program would probablly be smaller than 30K bytes and would work all all Windows platforms. It would take a few hours to write and would probably never need to be updated again. It would not pop up any DOS box. I would make it so the program gets it own location, with GetModuleFilename() and looks for an INI file in the same place with the same base name. Then I would put the link to it on the desktop.

> If you wanted to get fancy, it could even look around for the JVM if the specified one isn't found (or at least show a useful message).

> Another option is to do all this with a little JScipr, which can be run on all windows platforms with wscript. In that case, all the above details would be in the JScript, the link would contain wscript script.js and the Jscript would do the same trick of tacking its parameters on to the java call befure calling on it. You might want to make a nice custom icon for the link (in the exe suggestion above, you can add your nice icon to the exe itself).


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us