|
|
|
|
|
Re: Creating an installer for my RCP app [message #437692 is a reply to message #437688] |
Sun, 02 October 2005 15:22 |
Alex Blewitt Messages: 946 Registered: July 2009 |
Senior Member |
|
|
Since Java WebStart requires plugins to be shipped as packed Jars, it's only possible to use those that are packed. Not all of them (in the 3.1 distribution) are packed; open up Eclipse\plugins to see which are which. Directories represent unpacked plugins, Jars represent packed plugins. You can only use the packed ones in a Java WebStart app.
The documentation on using Java WebStart covers the information you're looking for:
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/java_web_start.htm
Specifically, regarding limitations:
Known limitations
---------------
o Eclipse Update and Java Web Start technologies can work together but under the following restrictions: plug-ins installed by Java Web Start can not be updated by Update and vice-versa. Features and plug-ins installed by Java Web Start can't be refered in the prerequisites of features that needs to be installed by Update;
o Help can not be deployed through Java Web Start. However it could be installed using eclipse Update, or the server serving your application could run a help server;
o Request to exit the application with a restart code are ignored;
o On the mac, applications can only be webstarted by clients using java 1.5.
It's up to you whether these are important issues to you. If you're not using Help, nor Mac OS X, nor need to change workspaces, it shouldn't affect you much. OTOH if you want to support Mac OS X, bear in mind that current Macs only have Java 1.4 installed on them by default.
|
|
|
|
|
|
|
Re: Creating an installer for my RCP app [message #437755 is a reply to message #437708] |
Tue, 04 October 2005 11:03 |
Alex Blewitt Messages: 946 Registered: July 2009 |
Senior Member |
|
|
JWS expects everything to be run as 'packed' Jars, in Eclipse terminology. However, the InfoCenter is powered by a behind-the-scenes Tomcat webserver that expects to find everything as individual java.io.Files within a directory on the local filing system.
That's one of the reasons why the helpcenter is still shipped as an 'unpacked' Jar, so that when Eclipse starts up the Jar is unpacked into a file repository. Of course, this behaviour doesn't happen in WebStart (which just leaves them as Jars) with the result that then Infocenter server fails to start up since the file doesn't exist.
(Granted, it's possible to change it; for example, instead of having files, use Class.getResource(), but the webserver started life as serving files so it's pretty tied into the way Tomcat works. I also have a sneaky suspicion that other help files are bundled as unpacked Jars, and pseudo-symlinks (probably at a config, rather than filing system level) are used to bring them all under one root. I'm guessing a future version will serve from Class resources rather than files, but it might be a way off)
There are several nifty approaches; another poster on this forum wrote an extractor to a temp directory in their plugin, so if Java WebStart was used, the tomcat engine could be launched from a separate TEMP type directory. Another is the suggestion that the Java WebStart app could be nothing more than installing a basic installer that then installs a pukka version of Eclipse locally.
Using any installer type (other than WebStart) is pretty much the same; it's just a case of figuring out where to put files and what the name of the VM to use is.
|
|
|
|
|
Re: Creating an installer for my RCP app [message #437825 is a reply to message #437767] |
Wed, 05 October 2005 15:03 |
scb Messages: 43 Registered: July 2009 |
Member |
|
|
in my Application class for the installer plugin, i never actually open
the workbench. the first thing it does is create a Display, shell, and
Directory Dialog. then i just feed a fileinputstream to the unzip class
and it does the installation work. hope the code comes out formatted ok
in this post
Display display = PlatformUI.createDisplay();
Shell shell = new Shell(display);
DirectoryDialog dlg = new DirectoryDialog(shell);
dlg.setMessage("Choose a location to install. ");
String path = dlg.open();
if (path != null)
{
//call code that unzips the zipped rcp app from the server.
boolean success = UnZip.unZip(YOUR FILEINPUSTREAM TO THE ZIP FILE,
path + "\\");
if (success)
{
MessageBox mesBox = new
MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION);
mesBox.setMessage("Successful Installation!");
mesBox.open();
}
}
I used the "Files" tools from http://myjavatools.com/ in the unzip class.
note that my class also assumes the zipped rcp app was actually a zipped
directory containnig the app (mainDir)
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.Adler32;
import java.util.zip.CheckedInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import com.myjavatools.lib.Files;
public class UnZip
{
public static boolean unZip(FileInputStream from, String outputPath)
{
try
{
final int BUFFER = 2048;
BufferedOutputStream dest = null;
CheckedInputStream checksum = new CheckedInputStream(from, new
Adler32());
ZipInputStream zis = new ZipInputStream(new
BufferedInputStream(checksum));
ZipEntry entry;
String mainDir = "";
while ((entry = zis.getNextEntry()) != null)
{
if (mainDir.equals("")) // first time
mainDir = entry.getName().substring(0,
entry.getName().indexOf("/") + 1);
//can't extract main Dir since we already created it
if (!entry.getName().equals(mainDir))
{
System.out.println("Extracting: " + entry);
int count;
byte data[] = new byte[BUFFER];
// write the files to the disk
// FileOutputStream fos = new
FileOutputStream(entry.getName());
FileOutputStream fos = Files.makeFile(new
File(outputPath + entry.getName()));
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER)) != -1)
{
dest.write(data, 0, count);
}
dest.flush();
dest.close();
}
}
zis.close();
System.out.println("Checksum: " +
checksum.getChecksum().getValue());
return true;
}
catch (Exception e)
{
MessageBox mesBox = new
MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR);
mesBox.setMessage("Error Installing");
mesBox.open();
e.printStackTrace();
return false;
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.04614 seconds