Accessing Java WebStart files

Hi all,
I have setup Java WebStart for all of our projects so clients can just go to the server web page, find a link and then click and launch the program they want. I am running a Glassfish server on a Linux box and can only get to the files on localhost. If I try to access the files remotely, I get Permission Denied, 403.
Is there a special configuration for Glassfish that is restricting remote users from getting files? I can get whatever file I want locally (http://localhost:8082/resource/file%3a/webstart/Project.jnlp, including the jars), but when I try to get them remotely, that is when Glassfish says Permission Denied and I have nothing in the logfiles that say what is going on.
On a sidenote, how would I access those files relative to the JAR I deployed? My JAR is at /website and I can get to /website/index.jsp, but not /website/Project.jnlp so my workaround is to use the resource configuration.
Walter

If the first jar file is an executable jar file (you run it via the command "java -jar whatever.jar"), then classes in it will not be able to load classes from other jar files unless you explicitly name those jar files in the "classpath" line of the executable jar file's manifest.

Similar Messages

  • Java3D, Webstart & file access

    I have a Java3D application that opens files (for example using ImageIO.read in TextLoader) perfectly well fom the local file system
    When I use the Webstart version of Java3D (http://download.java.net/media/java3d/webstart/release/java3d-latest.jnlp) there is a javax.imageio.IIOException: Can't read input file!.
    The file(s) are in the application jar - and are in the appropriate directory in the jar.
    My reading of an IBM document suggests that files should be accessed in Webstart through a getResource() call:
    +//Obtain the current classloader+
    ClassLoader classLoader = this.getClass().getClassLoader();
    +//Load the company logo image+
    Image companyLogo = classLoader.getResource("images/companyLogo.gif");
    and I am wondering if this is the problem?
    Dave

    I have though fixed the problem - it goes like this:
    1. Resources must be accessed through the class loader method getResource - Java3D is quite happy to work with a URL for a file resource derived in this way. The class loader will generate a URL that is appropriate to the way that the application was launched.
    2. J3D samples use a Resource.java class that is packaged to a certain point in the hierarchy
    3. The file resources must be placed in the same location as Resource.class. So if Resource.class is packaged to org.jdesktop.j3d.examples the file resources must be at /org/jdesktop/j3d/examples in the application JAR.

  • How to access variables declared in java class file from jsp

    i have a java package which reads values from property file. i have imported the package.classname in jsp file and also i have created an object for the class file like
    classname object=new classname();
    now iam able to access only the methods defined in the class but not the variables. i have defined connection properties in class file.
    in jsp i need to use
    statement=con.createstatement(); but it shows variable not declared.
    con is declared in java class file.
    how to access the variables?
    thanks

    here is the code
    * testbean.java
    * Created on October 31, 2006, 12:14 PM
    package property;
    import java.beans.*;
    import java.io.Serializable;
    public class testbean extends Object implements Serializable {
    public String sampleProperty="test2";
        public String getSampleProperty() {
            return sampleProperty;
    }jsp file
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.sql.*,java.util.*"%>
    <html>
    <head>
    <title>Schedule Details</title>
    </head>
    <jsp:useBean id="ConProp" class="property.testbean"/>
    <body>
    Messge is : <jsp:getProperty name="msg" property="sampleProperty"/>
    <%
      out.println(ConProp.sampleProperty);
    %>
    </body>
    </html>out.println(ConProp.sampleProperty) prints null value.
    is this the right procedure to access bean variables
    thanks

  • Jar files download problems in Java Webstart with JRE 1.6

    We have encountered a few problems in Java Webstart with JRE 1.6
    In JRE 1.5, the jar files are getting downloaded onto the client
    machine with it's original names.
    Example :
    Server File Name : acm.jar
    Client File Name : RMacm.jar
    But in JRE 1.6, the jar files are getting downloaded with improper file names.
    Example :
    Server File Name : acm.jar
    Client File Name : 4fb074cc-66fc7407
    Moreover the path itself seems to be invalid.
    Example Path :
    JRE 1.5 path:
    C:\Documents and Settings\Administrator\Application
    Data\Sun\Java\Deployment\cache\javaws\https\D17.16.23.11\P443\DMtest\DMwebStart
    JRE 1.6 path:
    C:\Documents and Settings\Administrator\Application
    Data\Sun\Java\Deployment\cache\6.0\12
    Due to this, we are facing Classpath problems.
    What changes do we have to make to the code, for Java
    Webstart to work ?
    We are using JBoss 4.0.4 and JDK 1.5 in the Server
    On the client machine, we have IE 6 and JRE 1.6.01
    Help would be appreciated.

    Ask your Java Web Start question at:
    http://forum.java.sun.com/forum.jspa?forumID=38

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • File Access with unsigned Applet through editing the java.policy file

    I'am starting to lose my hair on this...
    I am trying to get an applet to run so that it can access the file system to move files on my local maschin. Because this applet is only running on my VM i can change the java.policy to avoid the signing of the applet.
    first of all, if i wrote in the java.policy file
    grant {
      permission java.security.AllPermission; 
    };everything is working perfekt.
    But I have not the intention to open the gates for any applet out there, so i want to limit the access to my applet. With every of the following versions I get at best an
    java.security.AccessControlException: access denied (java.io.FilePermission...
    My Setup
    My Java Version: jre1.6.0_02
    My applet is located unter the url
    http://admin.mydomain.com/applet.jar
    In Html i tryed the following different versions of loading the applet - none worked
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet codebase="http://admin.mydomain.com" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet name="shortcut" code="start.class" archive="http://admin.mydomain.com/applet.jar" width="0" height="0"></applet>in java.policy i tryed following versions with every html applet load version
    grant codeBase "http://admin.x-press.de/-" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/+" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/applet.jar" {
      permission java.security.AllPermission; 
    };why is it with
    grant {
      permission java.security.AllPermission; 
    };working, and not with the other versions?
    i am almost bold now, please try to save my last hair from falling down.
    any suggestion would be nice
    thanks, feyyaz
    Message was edited by:
    feyyazdogu

    I read the mentioned documentation and your right, some of my versions were wrong, but after reading the doumentation again i came to following result which should had worked but didn't.
    java.policy
    grant codeBase "http://admin.mydomain.com/*" {
      permission java.security.AllPermission;
    HTML File
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" height="0" width="0"></applet>if I am entering http://admin.mydomain.com/applet.jar i can download the jar, so the archive lays in the correct directory.
    what i am doing wrong? do i have to change an additional file somewhere else?

  • Java.io.File causes "access denied" exception in a signed applet

    Hi,
    New to these forums and not entirely where it's appropriate to post this issue, so I'll stick it here for now until told otherwise.
    The problem:
    My applet throws the following exception.
    INFO: Exception Message: access denied (java.io.FilePermission C:\Some Dir With Spaces\AnotherDir\FinalDir read)
    The psuedo-code:
    java.io.File RootPath = new java.io.File( "C:\" );
    private boolean doesSubdirectoryExist(String directory) {
            boolean mResult = false;
            try
                java.io.File tmpPath = new java.io.File( RootPath.toString() + java.io.File.separatorChar + directory );
                mResult = tmpPath.isDirectory();
                tmpPath = null;
            catch (Exception e)
                ... error handling code
            return mResult;
    private void btnCheckPathActionPerformed(java.awt.event.ActionEvent evt) {
            ....some other stuff....
            doesSubdirectoryExist(.. a text field value from the GUI form..);
            ....some other stuff....
    }                                       The conditions:
    1) The applet is signed.
    2) The applet runs fine in the AppletViewer.
    3) I am using JDK1.5.0_09.
    4) When I click the button the event handler is tied to, it works correctly the first time.
    5) If I click a second time, with the same value in the text field (i.e. testing for the same subdirectory again) I get the exception error.
    I'm pulling my hair out trying to figure this one out. If it were a security issue with the applet running from a browser, why does it work the first time?
    Am I failing to release some lock that creating a java.io.File instance creates?
    I would appreciate any help.

    I've identified the issue. I was attempting to access the filesystem from two different thread and/or contexts.
    It seems that if I use the SwingWorker class from https://swingworker.dev.java.net/ to perform background tasks in the Worker thread, I don't get the security privileges required to modify the filesystem. Even though I have signed the jar correctly.
    However I can access the filesystem quite happily from the Event Dispatcher thread. If my jar is signed correctly.
    So, I have the following questions:
    1. Why doesn't SwingWorker worker threads get the same security context as the event dispatcher thread?
    2. Is there anyway I can give the worker thread the necessary security privileges?
    3. Is there anyway to do this without having to write my own thread handling code and creating my own thread pools?
    Message was edited by:
    Fidotas
    Message was edited by:
    Fidotas

  • Java - object file access

    how can I access randon to java object file
    thanks

    Can you clarify this question?
    I'm going to give an initial answer, based on a guess as to what you meant:
    BCEL lets you access the internals of a compiled Java class file (aka, the bytecode, aka the object code).

  • Trying to access the java script files via jar file in WEB SERVER

    hi all,
    I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ...
    in jsp the code goes like this...
         <script type="text/javascript"  archive="http://localhost:14000/dojo.jar!" src="dojo.jar/parser.js" " ></script>{code}
    But i am not able to access the js file which is put in jar file present in the  webserver.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    You can use DWR (Direct Web remoting) for that. It is easy AJAX for java. ou can directly call the java script function from java class and also java class from javaScripts..
    Regards,
    Hardik

  • Unable to open Java Webstart jnlp files in Mavericks

    Since upgrading to Mavericks I am unable to open Java webstart jnlp files in Safari.
    When trying to open the specified URL with the jnlp file, nothing happens, the download simply will not start.
    Tried different security settings in Safari & Java control panel
    It affects all applications using webstart.
    Java 7.45 & iOS 10.9

      Can you check which version of Camera Raw is installed - it needs to be version 6.2 or later for the 60D
    Open Full edit on the menu bar click:
    Help >> About Plug-In >> Camera Raw
    Press Esc to close the pop-up.
     

  • Download Error in java webstart

    Hi
    I am getting a error while downloading application from java webstart
    I am using Apache 2.2 http server running on port 80
    In that in htdocs folder I have placed my jnlp file and my jar file
    My jnlp file is like this .
    All file are in the folder htdocs/products/
    <jnlp spec="1.0+" codebase="http://127.0.0.1/" href="/products/note.jnlp">
    <information>
    <title>My Application </title>
    <vendor>ABC Pvt Ltd</vendor>
    <homepage href="http://127.0.0.1/products/"/>
    <description>Sample Test</description>
    <shortcut>
    <desktop/>
    <menu submenu="My Application 2.0 (web)"/>
    </shortcut>
    </information>
    <security><all-permissions/></security>
    <resources>
    <j2se version="1.4+" />
    <jar href="/products/Notepad.jar" main="true" download="eager"/>
    </resources>
    <application-desc main-class="Notepad">
    </application-desc>
    </jnlp>
    The error which i am getting is
    An error occurred while launching/running the application.
    Title: My Application
    Vendor: ABC Pvt Ltd
    Category: Download Error
    Bad MIME type returned from server when accessing resource: http://127.0.0.1/products/note.jnlp - text/plain
    JNLPException[category: Download Error : Exception: null : LaunchDesc: null ]
    at com.sun.javaws.cache.DownloadProtocol.doDownload(U nknown Source)
    at com.sun.javaws.cache.DownloadProtocol.isLaunchFile UpdateAvailable(Unknown Source)
    at com.sun.javaws.LaunchDownload.getUpdatedLaunchDesc (Unknown Source)
    at com.sun.javaws.Launcher.downloadResources(Unknown Source)
    at com.sun.javaws.Launcher.handleApplicationDesc(Unkn own Source)
    at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Please help ...
    How to solve this issue .
    But the same file is working in Tomcat Server
    please let me know
    Thank you
    Prakash

    Bad MIME type returned from server..A server should return a content type of..
    application/x-java-jnlp-file for JNLP
    files.
    Tomcat probably does that by default, but
    other servers might need to be told about it.
    See your server help, for how to set a
    content-type.

  • Error with Java WebStart Signed Jars on 1.6.0_19's new Mixed  Code

    All,
    First, we have a valid code signing certificate/keystore from Thawte that works for signing webstart jars as of update 18. For some reason, if you run our webstart application on update 19 JRE, the runtime believes that some of the jars are not signed and some are. Even though we create and sign the jars in the exact same way and after inspecting the jar the JRE believes are not signed they have the necessary signing entries/files in the manifest folder. Not sure why the signing process would work for some of our jars and not for others. There is nothing really all that different.
    So, because the JRE believes some of the jars are not signed the new security warning "...contains both signed and unsigned code." pops up ( [Error Description|http://java.com/en/download/help/error_mixedcode.xml] ). If I press yes, then I get the following exception.
    java.lang.SecurityException: trusted loader attempted to load sandboxed resource from https://path-to-our.jar
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.check(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.access$1400(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at main.JwsMain.main(JwsMain.java:32)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)If I press "no" I get the following exception (I get this exception if I try to run our WebStart application with no signed jars as well, no warnings about missing certs, just straight to error)
    java.lang.NullPointerException
         at com.sun.deploy.cache.CachedJarFile.findMatchingSignerIndices(Unknown Source)
         at com.sun.deploy.cache.CachedJarFile.entryNames(Unknown Source)
         at com.sun.deploy.cache.DeployCacheJarAccessImpl.entryNames(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler.assertTrust(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler.access$700(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.check(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.access$1400(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at main.JwsMain.main(JwsMain.java:32)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)Does anyone know why this would be happening? It only occurs with the new update. We use the same keystore and process for signing all of our jars so it really doesn't make since why some of them work and some of them don't. Also, our JNLP is correct or it wouldn't work in update 18.
    Edit: We've tried it on Windows XP SP3 and compiled the code using update 18 and used jarsigner both from 18 and 19 with same results.
    Edited by: chenthor on Apr 1, 2010 8:44 AM
    Edited by: chenthor on Apr 1, 2010 8:51 AM

    Hi All,
    So we've been battling this bug for a year or so now, and I've come up with a solution to the webstart bugs
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6967414
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6805618
    (see the bugs for more details)
    From what we can tell the bug stems from the way that the jar signers information is "cached" by webstart.
    When a jar is loaded by webstart, it is represented by a CachedJarFile instance. When loading and using classes the signature for the jar is verified. The signers used is the one that is stored in the CachedJarFile instances. These "signers" are stored as SoftReferences. SoftReferences are like WeakReferences, except that they only become eligible for garbage collection when there is a small amount of available heaps space remaining and that the object is only softly reachable. (That's a pretty crude description, but it will do for now)
    So what we found was happening is that when the JVM reached a certain heap size threshold and needed to allocate more heap, that these soft references (and hence the signers information) werebeing garbage collected. if you attempt to load a class after this you get the security error.
    So I came up with a hack to work around this. At application startup, iterate through all of the CachedJarFile objects on the classpath and create a hard reference to each of the signers info by putting them in a static list somewhere. From our tests this seems to work. (though with the intermittent nature of the problem, it has been hard to prove conclusively, though we've had some success repro-ing the issue, by reducing the intial heap size and using VisualVM to watch for heap expansions and forcing gc's)
    Below is the code for the hack, to run it just call JarSignersHardLinker.go() and it will do some sanity checks (running on webstart on java 1.6 update 19 or higher) before spawning a new thread to create hard refs for all signers info for all jars on the classpath.
    import java.io.IOException;
    import java.lang.ref.SoftReference;
    import java.lang.reflect.Field;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.JarURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Enumeration;
    import java.util.LinkedHashSet;
    import java.util.List;
    import java.util.Set;
    import java.util.jar.JarFile;
    * A utility class for working around the java webstart jar signing/security bug
    * see http://bugs.sun.com/view_bug.do?bug_id=6967414 and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6805618
    * @author Scott Chan
    public class JarSignersHardLinker {
        private static final String JRE_1_6_0 = "1.6.0_";
         * the 1.6.0 update where this problem first occurred
        private static final int PROBLEM_JRE_UPDATE = 19;
        public static final List sm_hardRefs = new ArrayList();
        protected static void makeHardSignersRef(JarFile jar) throws java.io.IOException {
            System.out.println("Making hard refs for: " + jar );
            if(jar != null && jar.getClass().getName().equals("com.sun.deploy.cache.CachedJarFile")) {
                 //lets attempt to get at the each of the soft links.
                 //first neet to call the relevant no-arg method to ensure that the soft ref is populated
                 //then we access the private member, resolve the softlink and throw it in a static list.
                callNoArgMethod("getSigners", jar);
                makeHardLink("signersRef", jar);
                callNoArgMethod("getSignerMap", jar);
                makeHardLink("signerMapRef", jar);
    //            callNoArgMethod("getCodeSources", jar);
    //            makeHardLink("codeSourcesRef", jar);
                callNoArgMethod("getCodeSourceCache", jar);
                makeHardLink("codeSourceCacheRef", jar);
         * if the specified field for the given instance is a Softreference
         * That soft reference is resolved and the returned ref is stored in a static list,
         * making it a hard link that should never be garbage collected
         * @param fieldName
         * @param instance
        private static void makeHardLink(String fieldName, Object instance) {
            System.out.println("attempting hard ref to " + instance.getClass().getName() + "." + fieldName);
            try {
                Field signersRef = instance.getClass().getDeclaredField(fieldName);
                signersRef.setAccessible(true);
                Object o = signersRef.get(instance);
                if(o instanceof SoftReference) {
                    SoftReference r = (SoftReference) o;
                    Object o2 = r.get();
                    sm_hardRefs.add(o2);
                } else {
                    System.out.println("noooo!");
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
                return;
            } catch (IllegalAccessException e) {
                e.printStackTrace();
         * Call the given no-arg method on the given instance
         * @param methodName
         * @param instance
        private static void callNoArgMethod(String methodName, Object instance) {
            System.out.println("calling noarg method hard ref to " + instance.getClass().getName() + "." + methodName + "()");
            try {
                Method m = instance.getClass().getDeclaredMethod(methodName);
                m.setAccessible(true);
                m.invoke(instance);
            } catch (SecurityException e1) {
                e1.printStackTrace();
            } catch (NoSuchMethodException e1) {
                e1.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
         * is the preloader enabled. ie: will the preloader run in the current environment
         * @return
        public static boolean isHardLinkerEnabled() {
             boolean isHardLinkerDisabled = false;  //change this to use whatever mechanism you use to enable or disable the preloader
            return !isHardLinkerDisabled && isRunningOnJre1_6_0_19OrHigher() && isRunningOnWebstart();
         * is the application currently running on webstart
         * detect the presence of a JNLPclassloader
         * @return
        public static boolean isRunningOnWebstart() {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            while(cl != null) {
                if(cl.getClass().getName().equals("com.sun.jnlp.JNLPClassLoader")) {
                    return true;
                cl = cl.getParent();
            return false;
         * Is the JRE 1.6.0_19 or higher?
         * @return
        public static boolean isRunningOnJre1_6_0_19OrHigher() {
            String javaVersion = System.getProperty("java.version");
            if(javaVersion.startsWith(JRE_1_6_0)) {
                //then lets figure out what update we are on
                String updateStr = javaVersion.substring(JRE_1_6_0.length());
                try {
                    return Integer.parseInt(updateStr) >= PROBLEM_JRE_UPDATE;
                } catch (NumberFormatException e) {
                    //then unable to determine updatedate level
                    return false;
            //all other cases
            return false;
          * get all the JarFile objects for all of the jars in the classpath
          * @return
         public static Set<JarFile> getAllJarsFilesInClassPath() {
              Set<JarFile> jars = new LinkedHashSet<JarFile> ();
             for (URL url : getAllJarUrls()) {
                 try {
                     jars.add(getJarFile(url));
                 } catch(IOException e) {
                      System.out.println("unable to retrieve jar at URL: " + url);
             return jars;
         * Returns set of URLS for the jars in the classpath.
         * URLS will have the protocol of jar eg: jar:http://HOST/PATH/JARNAME.jar!/META-INF/MANIFEST.MF
        static Set<URL> getAllJarUrls() {
            try {
                Set<URL> urls = new LinkedHashSet<URL>();
                Enumeration<URL> mfUrls = Thread.currentThread().getContextClassLoader().getResources("META-INF/MANIFEST.MF");
                while(mfUrls.hasMoreElements()) {
                    URL jarUrl = mfUrls.nextElement();
    //                System.out.println(jarUrl);
                    if(!jarUrl.getProtocol().equals("jar")) continue;
                    urls.add(jarUrl);
                return urls;
            } catch(IOException e) {
                throw new RuntimeException(e);
         * get the jarFile object for the given url
         * @param jarUrl
         * @return
         * @throws IOException
        public static JarFile getJarFile(URL jarUrl) throws IOException {
            URLConnection urlConnnection = jarUrl.openConnection();
            if(urlConnnection instanceof JarURLConnection) {
                // Using a JarURLConnection will load the JAR from the cache when using Webstart 1.6
                // In Webstart 1.5, the URL will point to the cached JAR on the local filesystem
                JarURLConnection jcon = (JarURLConnection) urlConnnection;
                return jcon.getJarFile();
            } else {
                throw new AssertionError("Expected JarURLConnection");
         * Spawn a new thread to run through each jar in the classpath and create a hardlink
         * to the jars softly referenced signers infomation.
        public static void go() {
            if(!isHardLinkerEnabled()) {
                return;
            System.out.println("Starting Resource Preloader Hardlinker");
            Thread t = new Thread(new Runnable() {
                public void run() {
                    try {
                        Set<JarFile> jars = getAllJarsFilesInClassPath();
                        for (JarFile jar : jars) {
                            makeHardSignersRef(jar);
                    } catch (Exception e) {
                        System.out.println("Problem preloading resources");
                        e.printStackTrace();
                    } catch (Error e) {
                         System.out.println("Error preloading resources");
                         e.printStackTrace();
            t.start();
    }

  • Can't find xml within jar with java webstart

    I use Jasper Reports,I am reading a xml file in my application.
    The code I use to read this xml file is:
    JasperCompileManager.compileReportToFile("xmlfile.xml","jasperfile.jasper");
    When I run this code in JBuilder it run fine.
    But when I compile the classes and this xml to my jar file,sign it and then try to run it in java Webstart.It tells me that it can not find the path.
    What is wrong?

    I don't know Jasper Reports, so I may be wrong here.
    A file inside a .jar file is not a file on the filesystem, and cannot be accessed with java.io file-related classes. You should use ClassLoader.getResource() to get an inputstream reading from it.

  • JAVA Webstart preferences panel doesn't show

    Hello,
    I am running on Windows 2000 and I have installed JAVA Webstart including JRE 1.3.1_01. After the installation I have added 'javaws.cfg.proxy.setting=NONE' into my javaws.cfg file, which enabled me to finally start the JAVA Webstart application manager. But- I can't get the preferences panel to show up? When I click on the preferences- tab basically nothing happens!
    I have already tried to deinstall WebStart and install it again, but this didn't solve the problem. Is anybody out there, who had this problem as well and knows how to solve it?

    Hello,
    I have now been able to add an entry to the 'javaws.cfg' files (javaws.cfg.showConsole=true), which now brings up the JAVA Console. When I now press the 'preferences' options to bring up the JAVAWS preferences panel, I get the following errors displayed:
    java.lang.NullPointerException
    at com.sun.javaws.proxy.WinInternetProxy.getNSVersion(Unknown Source)
    at com.sun.javaws.proxy.WinInternetProxy.getBrowserInfo(Unknown Source)
    at com.sun.javaws.ui.prefs.GeneralPanel.<init>(Unknown Source)
    at com.sun.javaws.ui.prefs.WinSubcontrollerCreator.getSubcontroller(Unknown Source)
    at com.sun.javaws.ui.prefs.PrefsPanel.createSubcontroller(Unknown Source)
    at com.sun.javaws.ui.prefs.PrefsPanel.access$0(Unknown Source)
    at com.sun.javaws.ui.prefs.PrefsPanel$1.createSubcontroller(Unknown Source)
    at com.sun.javaws.ui.general.AbstractController.setActiveSubcontrollerIndex(Unknown Source)
    at com.sun.javaws.ui.prefs.PrefsPanel.setSelectedTab(Unknown Source)
    at com.sun.javaws.ui.prefs.PrefsPanel.<init>(Unknown Source)
    at com.sun.javaws.ui.player.Player$4.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Is there any way to get around this?
    Might it have something to do, that I am running on Windows Internet Explorer V.6?
    Please, help me!
    THANKS!

  • Info on java webstart

    hi i have been interested in java webstart but i can only find information expalining what it is not how to use it. the literature that i read stated that you can run a java program from a single click from a website and not much else. i assume that you have to do more than just put a link the executable jar file? if so can you give me a link that shows how to use it please.

    >
    when you day a step learning curve how hard is it?>It depends on the application,
    - if it is 'one jar with no natives' it might be relatively simple.
    - another factor is whether the code needs to be digitally signed.
    If you are familiar with code signing already, that should not be a problem. Or it will also not be a problem if this app. can run entirely sandboxed, like a common applet, though that is unusual for an average desktop app. that needs to access the the local file system, etc.. Even in that case, it is possible to have a sandboxed (unsigned) app. that can access the local disks, but you need to use the JNLP API, rather than the usual JFileChooser and File classes.
    What is your app.? What sort of things does it do?
    Another factor is just how many of the little 'added extras' of webstart you would like to use for the app. Shortcuts and menu items, a splash screen and icons for the app. and shortcuts etc. - these are all specified in the JNLP file that actually launches the application.
    And to answer an earlier question, instead of linking to the main jar, a JWS launch would link to the JNLP file. The JNLP file specifies all the resources, shortcuts etc. as well as the main class.
    To make sure the necessary Java is in place (before the user clicks the link to the JNLP), Sun provides the [deployJava.js|https://jdk6.dev.java.net/deployment_advice.html] which you can use on the site that links to the application launch file.

Maybe you are looking for

  • Regarding purchase order

    hi,   is there any standard report for open purchase order ? what are the tables and field used for open purchase order report. thank u   ravi

  • Windows adobe application manager download error.

    The AAP has a download error to where I cant access my apps on windows.

  • ORA- 01110  RMAN RECOVERY

    Dear All, I'm becaming crazy to restore my oracle XE database; I backup my database using: backup database plus archivelog; delete archivelog all; crosscheck archivelog all; Unfortunately my database during apex 3.2 update jump down and now I'm tryin

  • Buying a US iPad2 to Use in UK. Do I need to initialise it before I leave the States?

    Hi everyone I'm getting my wife an iPad2 for her birthday. I'm in the States right now, and they are about £100 cheaper here.  I kow I need to buy an AT&T version for it to work with a UK mircoSIM (Vodafone), but I am finding conflicting info on whet

  • Wierd applet entry in my Console log.  What is it?

    I found this entry in my Console log, does anyone know what this is? Is this spyware? Sun Nov 09 08:28:04 EST 2008 JEP creating applet reportcard2.ReportCard (http://i.cmpnet.com/nc/java/) Interactive Report Card version 2.0, written by Mike Lee. I G