本文介绍了为什么Desktop.Open()不与MagicISO工作正在安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的code

if (Desktop.isDesktopSupported()) {
  Desktop desktop = Desktop.getDesktop();

  if (desktop.isSupported(Desktop.Action.OPEN)) {
    try {
      desktop.open(file.getCanonicalFile());
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  } else {
    System.out.println("Desktop open action is not supported");
  }
} else {
  System.out.println("Desktop is not supported");
}

我知道,在安装MagicISO(从得到了它),将使这个code不工作。但为什么?什么是MagicISO specificially吗?我可以prevent它发生或周围的工作呢?

I know that installing MagicISO (got it from this Java bug) will make this code doesn't work. But why? What does MagicISO specificially do? Can I prevent it to happen or work it around?

更糟糕的是,这code不抛出任何异常。它只是保持沉默着。这真的真的让我疯了。

Even worse, this code doesn't throw any exception. It just stays silent there. This really really makes me crazy.

推荐答案

好吧,如果我不得不采取一种猜测,MagicISO修改了其中一些从知道什么程序与启动文件prevents Java的方式注册表或东西。如果你正在寻找一个替代解决方案,请参阅布特罗斯·阿德尔的答案

Well if I had to take a guess, MagicISO modifies the registry or something in some way which prevents Java from knowing what program to launch the file with. If you're looking for an alternative solution, see Adel Boutros's answer

这篇关于为什么Desktop.Open()不与MagicISO工作正在安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:56