Self-Extracting JAR

I have a JAR file called Installer.jar and its contents are some class files and another jar called Updater.jar

The Installer.jar extracts the Updater to a user-specified destination, and then the updater downloads all the needed files from the internet. This worked except when I did the following:

1. Download from FireFox

2. Click "Open"

I get the error:

java.io.FileNotFoundException: SFC_Installer.jar (The system cannot find the file specified)

at java.util.zip.ZipFile.open(Native Method)

at java.util.zip.ZipFile.<init>(Unknown Source)

at java.util.zip.ZipFile.<init>(Unknown Source)

at install.JarResources.init(JarResources.java:57)

at install.JarResources.<init>(JarResources.java:31)

at install.OperatingSystem.run(OperatingSystem.java:80)

This is because it searching for this jar file in the System.getProperty("user.dir") directory. When clicking "open" from firefox, the current directory is not that of the file. How do I get this to work even when someone presses "open" instead of directly double-clicking the file?

Thanks in advance.

[1158 byte] By [Nethera] at [2007-11-27 8:48:30]
# 1

Well, at least I thought of a temporary solution since it seems like nobody knows the answer.

When the Installer.jar program is executed, it checks to see if Installer.jar is in the current directory.

if(itIsInTheDirectory()){

//all is well

}

else{

//pop up a JFileChooser which asks the user to "find" the Installer.jar file for it

}

Nethera at 2007-7-12 20:55:40 > top of Java-index,Java Essentials,Java Programming...
# 2
Class.getResourceAsStream() would look inside the jar.
-Kayaman-a at 2007-7-12 20:55:40 > top of Java-index,Java Essentials,Java Programming...