File f = new File(launcherUrl.getPath());
File f = new File(launcherUrl.getPath()).getAbsoluteFile();
    public static String getInstallDir(String[] args)            throws IOException, MalformedURLException {        // check if home directory is set via command line arg. If not,        // we'll get it from the location of the jar file this class        // has been loaded from.        String installDir = null;        // first, try to get helma home dir from command line options        for (int i = 0; i < args.length; i++) {            if (args[i].equals("-i") && ((i + 1) < args.length)) {                installDir = args[i + 1];            }        }        URLClassLoader apploader = (URLClassLoader)                                   ClassLoader.getSystemClassLoader();        // try to get Helma installation directory        if (installDir == null) {            URL launcherUrl = apploader.findResource("helma/main/launcher/Main.class");                // this is a  JAR URL of the form                //    jar:<url>!/{entry}                // we strip away the jar: prefix and the !/{entry} suffix                // to get the original jar file URL                String jarUrl = launcherUrl.toString();                if (!jarUrl.startsWith("jar:") || jarUrl.indexOf("!") < 0) {                    throw new RuntimeException("  Unable to get JAR URL from "+jarUrl);                }                jarUrl = jarUrl.substring(4);                int excl = jarUrl.indexOf("!");                jarUrl = jarUrl.substring(0, excl);                launcherUrl = new URL(jarUrl);                File f = new File(launcherUrl.getPath());                installDir = f.getParentFile().getCanonicalPath();        }        // set System property        System.setProperty("helma.home", installDir);        // and return install dir        return installDir;    }