Help? How do you Auto Install or use Web Start?

Hello All :o

First, can someone please direct me to some Web Start tutorials? I am totally clueless when it comes to Web Start, and I can’t seem to find a 100% beginner tutorial on how to create a Web Start program, have it download/install JOGL, and how to make it available on the web. I just don’t get it. ???

Ok, now my other question. I’ve seen this asked before, but I have never seen it answered. How do you deploy your game without Web Start? I would like this because some people would like to download my game and then play it where there is little or no internet. This is usually the reason why people download games. You go to your grandmother’s, and there isn’t any internet, so you want something to do. You’re at school where the internet blocks websites, etc. This way you can download it at home and then play it wherever you want. I will describe in detail how I would like this to be done:

1.) The user downloads my game (.zip file) and then extracts it to a folder. Then inside of the folder are three files: GameInstall.jar, GameRun.jar, and GameData.jar.

2.) The user double clicks (or does java -jar) on GameInstall.jar. It first asks you what directory you would like to install (or update) JOGL into. Then it begins to install it there.

NOW, I would think that this would be possible? If a Web Start program can download and install from https://jogl.dev.java.net/webstart/jogl.jnlp, then I should be able to do the same! How would I use Java networking to download something from the internet and install it? Is there not networking/socket code in Java to allow us to download and install something from the internet? If this is not possible, then could I make Java Web Start program that does nothing but installs JOGL and a dummy .jar file? This has to 100% work, then my program just uses that directory, right?

I just don’t see how this is impossible to do. :-\

Please reply, thanks.
~IntuitSea!~

Hi!

TUER uses JOGL and Java Webstart. Therefore I can answer you. Please feel free to look at tuer.jnlp (in the links below), it will give you an idea of how to do.

Deploying games using JOGL without Java Webstart is complicated but you can use Java Webstart offline, what is the matter then? You can provide a zip file containing a JAR and a JNLP file, the user double clicks on the jnlp file icon and that’s all…

Ok, cool, thanks! If you provide a zip file with the jnlp like you said, can you specify the directory where to install JOGL? I would really like my clients to just have JOGL installed once (like C:/jogl). Then my GameRun.jar will use the directory to run the game. I don’t want JOGL installed every time for every game (waste of time and space).

Web Start handles this for you, when you provide the JOGL libraries as extension.

Well, after testing a bit, I have to dissent myself :frowning:

It turned out that you either can install a JWS app directly from the net or start it from a offline tuned jnlp, but you cannot install it from the offline jnlp, because JWS caching only works over http protocol and not via file URLs. What’s even worse is that you can let JWS create a desktop/startmenu icon for you, but starting the app via the icon results in an mainclass not found error… what a mess.

:frowning: AAARGH! >:(

What about relying on localhost?

do you know the flag -import?
http://today.java.net/pub/a/today/2008/07/10/distributing-web-start-via-cd-rom.html
install with -import and update via jnlp… pretty cool

You can’t request a http resource without a webserver running. I could setup a minimal webserver with the installer-desc extension, but this is a bad workaround and will probably cause problems with personal firewalls…

Thanks for the hint. On the first look this seems to be indeed what I am searching for.

For anyone that is interested, I am just going to make two methods of downloading:

Method 1 - Includes the jar’s and native libraries and allows you to move the “jogl” folder included wherever you like. Then run GameSetup.jar to set the directory where jogl is located. If you do not move the folder, then you don’t have to run GameSetup.jar, just run GameRun.jar immediately.

MyGame - Windows
MyGame - Mac OSX
MyGame - Linux

Method 2 - Does not include the jar’s and native libraries, but you have to run GameSetup.jar to set the directory where jogl is located.

JOGL Homepage to download files

MyGame

Now, I may implement GameInstall.jar into method 2 using the following code:


InputStream in = null;
FileOutputStream out = null;

try {
  URL url = new URL("https://jogl.dev.java.net/webstart/jogl.jar");
  //https://jogl.dev.java.net/webstart/jogl-natives-win32.jar, etc.
  in = url.openStream();
  out = new FileOutputStream("./temp/jogl.jar");
  int c = 0;
  while((c = in.read()) != -1) {
    out.write(c);
  }
}
catch(Throwable t) {
  System.err.println("ERROR");
}
finally {
  if(in != null) {
    in.close();
  }
  if(out != null) {
    out.close();
  }
}


But I probably won’t do this because of proxies. It will accept a Proxy class, but I don’t want my users to have to input that in, etc.

GameRun.jar takes the directory that the user specified using GameSetup.jar and searches in it to find the “lib” folder. Then it adds it to the classpath:

java -classpath “.;GameData.jar;jogl/lib/jogl.jar;jogl/lib/gluegen-rt.jar” -Djava.library.path=“jogl/lib/” -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true mygame.MyGame

I thought that I would post this in case any else needed a solution to deploying jogl games without using webstart…

Web Start always hangs on me when I try to run it because of my crappy internet at home. So I usually never play any Web Start games because of it ::slight_smile: . The only way I can download stuff easily is through my browser Opera. Opera’s network code is amazing, so everything goes flawlessly. So the methods above is probably what I will do.

I’m confused - why are you so concerned about letting the user have the jogl folder where they want and/or downloading it on the fly? Jogl is an internal part of your game that users don’t want to know about and shouldn’t care about. Why not just ship the whole thing with the files it needs and be done with it?

Every additional step you add frustrates users and makes them give up and go elsewhere. Plus you add the extra uncertainty of the user running against a different version of jogl that you tested against. Why cause yourself and users additional pain for no actual benifit?

Including the windows jogl adds 2 mb to the file size. Including the mac os x jogl adds 4 mb to the file size. If the user specifies a directory such as C:/jogl and updates and installs jogl only there, that can shed pounds off of their download time and harddrive space. If I make 10 games and they only have one 4mb jogl folder where each game directs to, then that saves 36 mb’s off of their harddrive space and most importantly download time. I’m doing this for advanced users. If you aren’t concerned with memory/download time, then the user can use Method 1 to download my game, which will have the Jogl files that I used to compile the game with, and you don’t have to do anything but double click on GameRun.jar (and make sure you have JRE updated).

I wouldn’t care about an overhead of just 2Mb in a download, it’s not worth the trouble:

  1. You will have to make sure all your games keep working with the version of JOGL you ship (if you update your JOGL version). That’s also why for example installing JOGL in the JRE (such as in lib/ext) is such a bad idea.
  2. Like Orangy Tang said, it’s not a good idea to let your users worry about some internal libraries like JOGL.
  3. In the time the user had to spend in ‘JOGL install dialogs’ etc, he could have downloaded the JOGL libs automatically anyway. Probably more than once.

I’d just use Java Web Start. You probably want to update your game every now and then anyway, and JWS will make sure your users will get it automatically.
Here’s a nice tutorial: http://www.cokeandcode.com/webstarthowto

There’s also the added download time of the JRE (if different version) each game. Also, are there any restrictions of what you can do in Web Start? Like full-screen exclusive? Create files on the harddrive? Etc. I’ll probably use JWS, but I don’t want to learn everything about it if it turns out garbage.

You can do everything you can do with a normal application using webstart, if you sign your application.

Ok, sorry guys and gals I don’t mean to keep dragging this topic further, but I still have some questions about Web Start. I’m going to provide my users with Web Start (and other alternate methods). My question is where does Web Start install your files? I know you can go do “javaws -viewer” and see, but most Windows users don’t know how to use the command line. If they want to know where my files are so that they can uninstall it, how can I tell them the location of the files? Is the current directory automatically set to this? Thanks again.

It depends on the machine. But they can uninstall programs inside Java options in control panel or even windows unstaller.

Yes, webstart installed apps are visible in windows standard software list and can be uninstalled from there.