Java Web Start from CD

From: Roedy Green (roedy_at_seewebsite.com)
Date: 10/19/03


Date: Sun, 19 Oct 2003 05:46:37 GMT

On Sun, 19 Oct 2003 04:10:19 +0100, "Mike"
<mike@n-o--s-p-a-m.luusac.co.uk> wrote or quoted :

>I don't recall having to do that once JWS is installed on the client. The
>only thing that springs to mind is setting the mime type on a web server:

I got friend to do a JRE install on a Java virgin machine, and lo to
my delight, it set up the association.

I now how have a self installing Java Web Start CD. I am 99% there. I
think the problem has to do when you use trailing / and when you
don't.

You just put it in, and up comes the familiar dialog box about "do you
Trust this Roedy Green fellah with this certificate."

The key is this little C: program that autorun.inf
kicks off.. It is crude but simple. It depends on 26 variants of the
JNLP file being automatically generated.

/**
 * setup.cpp :
 * invokes corresponding setup?.jnlp file when invoked from a CD
 * setup.exe usually triggered by autorun.inf
 * For windows only.
 * copyright (c) 2003 Roedy Green, Canadian Mind Products
 * #327 - 964 Heywood Avenue
 * Victoria, BC Canada V8V 2Y5
 * tel:(250) 361-9093
 * http://mindprod.com
 */

#include "stdafx.h" /* standard precompiled header */

#include <direct.h> /* chdir, mkdir */
#include <process.h> /* exec, spawn */
#include <stdio.h> /* fclose, fgetc, printf, remove, rename, setvbuf
*/
#include <stdlib.h> /* exit, putenv, _splitpath */
#include <string.h> /* strcpy, strcat, strcmp, strupr */

/* Configure root name of all the jnlp files we might invoke */
const char* jnlpBaseName = "replicatorreceivercd";

// Java webstart is usually here, but we can't count on it.
// "C:\\Program Files\\Java\\j2re1.4.2_01\\javaws\\javaws.exe";

int main( int argc, char* argv[] )
   {
   // get current drive letter.
   char curDrive = 'A' + _getdrive() - 1;

   // generate name of jnlp file corresponding to CD drive letter
   char jnlpName [50];
   strcpy( jnlpName, jnlpBaseName );
   // tack on drive letter
   int baseLength = strlen( jnlpBaseName );
   jnlpName[ baseLength ] = curDrive;
   jnlpName[ baseLength + 1 ] = 0;
   strcat ( jnlpName, ".jnlp" );
   printf ("Installing %s with Java Web Start\n", jnlpName );

   // start up Java Web Start with for example
replicatorreceiverR.jnlp
   // cmd.exe on path in c:\winnt\system32
   if ( _spawnlp( _P_OVERLAY, "cmd.exe", "cmd.exe", "/C", jnlpName,
NULL ) )
      {
       // ENOENT = 2 = not found
       // EINVAL = 22 = invalid arg
      printf ("Java Web Start must be installed first. Error %u\n",
errno );
      }
   return 0;
   }

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming. 
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Relevant Pages

  • Re: Experiments with speech to text
    ... I think of the months I devoted to honing my keyboard skills and how ... Yet I don't see a generic speech editor being much use for Java. ... Dealing with caps has been the most frustrating thing. ... Canadian Mind Products, Roedy Green. ...
    (comp.lang.java.programmer)
  • Re: Get path
    ... there if you exec from Java. ... program squirrel the install program directory away in the registry ... Canadian Mind Products, Roedy Green. ... Coaching, problem solving, economical contract programming. ...
    (comp.lang.java.gui)
  • Re: Creating an array of objects (newbie question)
    ... Roedy Green Canadian Mind Products ... The Java Glossaryhttp://mindprod.com ...
    (comp.lang.java.programmer)
  • Re: exclude word on a regexp
    ... Roedy Green Canadian Mind Products ... The Java Glossaryhttp://mindprod.com ...
    (comp.lang.java.programmer)
  • Re: Java and .NET (no Flames Pls)
    ... And for this reason Visual Studio has superior support for Web ... web server you're going to use, or what operating system you are going ... It does have a java debugger, ... there are HTML plugins, web service plugins, visual form editing tools, ...
    (microsoft.public.dotnet.framework)