Code example for Attributes

Methods: getValueput

0
	/** Add the jar file to the classpath in the MANIFEST.MF file */  
    protected void updateClasspath(Manifest manifest) throws DeployException {
    	Attributes mainAttributes = manifest.getMainAttributes();
    	String classpath = null; 
        if (mainAttributes != null) {
        	classpath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
        } 
         
        String newJar = getJarFileNameWithDotSlash();
    	if ( classpath == null ) {
    		mainAttributes.put(Attributes.Name.CLASS_PATH,newJar);
    		System.out.println("Added "+newJar+" to classpath");
    	} else if ( classpath.indexOf(newJar) < 0 ) {
    		mainAttributes.put(Attributes.Name.CLASS_PATH,classpath+" "+newJar);
    		System.out.println("Added "+newJar+" to classpath");
    	} else { 
    		System.out.println(newJar+" already on the classpath.");
    	} 
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java