当前位置: 首页>>代码示例>>Java>>正文


Java Installer类代码示例

本文整理汇总了Java中org.netbeans.installer.Installer的典型用法代码示例。如果您正苦于以下问题:Java Installer类的具体用法?Java Installer怎么用?Java Installer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Installer类属于org.netbeans.installer包,在下文中一共展示了Installer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEngineLocation

import org.netbeans.installer.Installer; //导入依赖的package包/类
private static File getEngineLocation() {
    final String propName = EngineResources.LOCAL_ENGINE_PATH_PROPERTY;

    if (System.getProperty(propName) == null) {
        File cachedEngine = new File(Installer.getInstance().getLocalDirectory(), 
                DEFAULT_ENGINE_JAR_NAME);
        System.setProperty(propName, cachedEngine.getAbsolutePath());
    } 
    return new File(System.getProperty(propName));       
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:EngineUtils.java

示例2: createUninstaller

import org.netbeans.installer.Installer; //导入依赖的package包/类
protected Launcher createUninstaller(ApplicationDescriptor descriptor, boolean uninstall, Progress progress) throws IOException {
    LogManager.log("creating uninstaller...");
    
    final File engine = new File(descriptor.getInstallPath(),
            "uninstall.jar");
    try {
        EngineUtils.cacheEngine(engine, new Progress());
        
        final LauncherProperties props = new LauncherProperties();
        
        props.addJVM(new LauncherResource(false, SystemUtils.getCurrentJavaHome()));
        for(LauncherResource jvm : uninstallerJVMs) {
            props.addJVM(jvm);
        }
        props.addJar(new LauncherResource(true, engine));
        props.setJvmArguments(new String[]{
            "-Xmx256m",
            "-Xms64m",
            "-D" + Installer.LOCAL_DIRECTORY_PATH_PROPERTY +
                    "=" + Installer.getInstance().getLocalDirectory()});
        props.setMainClass(EngineUtils.getEngineMainClass().getName());
        
        if (uninstall) {
            props.setAppArguments(descriptor.getUninstallCommand());
            props.setOutput(
                    new File(descriptor.getInstallPath(), "uninstall"),
                    true);
        } else {
            props.setAppArguments(descriptor.getModifyCommand());
            props.setOutput(
                    new File(descriptor.getInstallPath(), "modify-install"),
                    true);
        }
        return SystemUtils.createLauncher(props, progress);
    } finally {
        FileUtils.deleteFile(engine);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:NativeUtils.java

示例3: execute

import org.netbeans.installer.Installer; //导入依赖的package包/类
@Override
public void execute(CLIArgumentsList arguments) throws CLIOptionException {        
    System.setProperty(Installer.BUNDLE_PROPERTIES_FILE_PROPERTY,
            arguments.next());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:BundlePropertiesOption.java

示例4: execute

import org.netbeans.installer.Installer; //导入依赖的package包/类
@Override
public void execute(CLIArgumentsList arguments) throws CLIOptionException {
    System.setProperty(Installer.LOCAL_DIRECTORY_PATH_PROPERTY,
            new File(arguments.next()).getAbsolutePath());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:UserdirOption.java

示例5: execute

import org.netbeans.installer.Installer; //导入依赖的package包/类
@Override
public void execute(CLIArgumentsList arguments) throws CLIOptionException {
    System.setProperty(Installer.IGNORE_LOCK_FILE_PROPERTY, UNARY_ARG_VALUE);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:IgnoreLockOption.java

示例6: getEngineMainClass

import org.netbeans.installer.Installer; //导入依赖的package包/类
public static Class getEngineMainClass() {
    return Installer.class;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:EngineUtils.java

示例7: execute

import org.netbeans.installer.Installer; //导入依赖的package包/类
@Override
public void execute() {
    LogManager.logIndent("Start products uninstallation");
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToUninstall();
    final int percentageChunk = Progress.COMPLETE / products.size();
    final int percentageLeak = Progress.COMPLETE % products.size();
    
    overallProgress = new CompositeProgress();
    overallProgress.setPercentage(percentageLeak);
    overallProgress.synchronizeDetails(true);
    
    getWizardUi().setProgress(overallProgress);
    for (Product product : products) {         
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        overallProgress.setTitle(StringUtils.format(
                getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                product.getDisplayName()));
        try {
            product.uninstall(currentProgress);
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        }  catch (UninstallationException e) {
            // do not override already set exit code
            if (System.getProperties().get(Installer.EXIT_CODE_PROPERTY) == null) {
                 System.getProperties().put(Installer.EXIT_CODE_PROPERTY, 
                         new Integer(UNINSTALLATION_ERROR_CODE));
            }
            // adjust the component's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.INSTALLED);
            product.setUninstallationError(e);
            
            // since the product failed to uninstall  - we should remove
            // the components it depends on from our plans to uninstall
            for(Product requirement : registry.getProducts()) {
                if ((requirement.getStatus() == Status.TO_BE_UNINSTALLED) &&
                        registry.satisfiesRequirement(requirement, product)) {
                    UninstallationException requirementError =
                            new UninstallationException(
                            StringUtils.format(
                            getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                            requirement.getDisplayName(),
                            product.getDisplayName()), e);
                    
                    requirement.setStatus(Status.INSTALLED);
                    requirement.setUninstallationError(requirementError);
                    
                    products.remove(requirement);
                }
            }
            
            // finally notify the user of what has happened
            ErrorManager.notify(ErrorLevel.ERROR, e);
        }
    }
    LogManager.logUnindent("... finished products uninstallation");
            
    LogManager.logUnindent("... starting updates and plugins uninstallation");        
    try {
        // delete updated files and downloaded plugins in installation folder
        FileUtils.deleteFiles(new ArrayList<File>(UninstallUtils.getFilesToDeteleAfterUninstallation()));            
        
        // delete all empty folders in installation directory                          
        FileUtils.deleteFiles(UninstallUtils.getEmptyFolders());
    } catch (IOException ex) {
        LogManager.log(ex);
    }
    LogManager.logUnindent("... finished updates and plugins uninstallation");        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:UninstallAction.java


注:本文中的org.netbeans.installer.Installer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。