Java 7 update 45 broke my Web Start SWT application

前端 未结 3 484
后悔当初
后悔当初 2021-02-06 15:28

I maintain an Eclipse RCP application launched with WebStart. Java 7 u45 made some security changes, and now my application crashes on startup.

I\'ve added to the manifes

3条回答
  •  失恋的感觉
    2021-02-06 15:38

    I have experienced the same issue and managed to solve it by doing following:

    In all manifest files (for each JAR in your RCP project) add these attributes:

    Application-Name: My App Name
    Permissions: all-permissions
    Codebase: *
    Application-Library-Allowable-Codebase: *
    Caller-Allowable-Codebase: *
    Trusted-Library: true
    

    Second part of solution is to make jnlp properties secure by adding jnlp prefix. I have found solution here. You need to do this for framework properties (osgi, eclipse..) and for your properties E.g. instead of:

    
    
    
    
    

    use

    
    
    
    
    

    Download eclipse launcher with sources from here

    In web start launcher you need to change back property names to old values (without jnlp prefix). You can do that by adding this part of source into main method of WebStartLauncher class.

    Properties properties = System.getProperties();
    // copy properties to avoid ConcurrentModificationException
    Properties copiedProperties = new Properties();
    copiedProperties.putAll(properties);
    Set keys = copiedProperties.keySet();
    for (Object key : keys) {
        if (key instanceof String) {
            String keyString = (String) key;
            if (keyString.startsWith("jnlp.")) {
                // re set all properties starting with the jnlp-prefix 
                // and set them without the prefix
                String property = System.getProperty(keyString);
                String replacedKeyString = keyString.replaceFirst("jnlp.", "");
    
                System.setProperty(replacedKeyString, property);
            }
        }
    }
    
    
    

    Export you new launcher as runnable JAR and put it in the same directory where your JNLP file is located.

    Edit JNLP file by adding this line:

    
    

    inside tag and edit your application-desc tag like this:

    
      
    

    提交回复
    热议问题