本文整理汇总了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));
}
示例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);
}
}
示例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());
}
示例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());
}
示例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);
}
示例6: getEngineMainClass
import org.netbeans.installer.Installer; //导入依赖的package包/类
public static Class getEngineMainClass() {
return Installer.class;
}
示例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");
}