2

我需要从我的应用程序中打开 Windows 的虚拟键盘,它将使用 Eclipse RCP 在 windows 32 位平台(即 win32 JRE)上进行部署。

按照帖子的答案在 Java 程序中打开 Windows 虚拟键盘,应用程序在 32 位 Windows 操作系统上正确运行,但拒绝在 64 位 Windows 操作系统上运行。

我正在使用的解决方案如下:

//          String sysroot = System.getenv("SystemRoot"); //$NON-NLS-1$
//          Runtime.getRuntime().exec("cmd.exe /c "+sysroot + "\\system32\\osk.exe /n"); //$NON-NLS-1$ //$NON-NLS-2$
            Runtime.getRuntime().exec("osk");

有没有办法在不使用 64 位部署的情况下解决这个问题?(我无法创建,只要我使用不支持此环境的库)。

谢谢

4

3 回答 3

0

这是我的解决方法:

FileOutputStream fileOutputStream = new FileOutputStream(new File("C:/TEMP/RUN.BAT"));

        String file = "START C:/Windows/System32/osk.exe" + '\n'
                + "EXIT";
        fileOutputStream.write(file.getBytes());
        fileOutputStream.close();
        Runtime.getRuntime().exec("CMD /C START C:/TEMP/RUN.bat");
        Runtime.getRuntime().exec("CMD /C DEL C:/TEMP/RUN.bat");
于 2011-12-19T13:27:36.683 回答
0

不可以。您将无法在 32 位 Java 应用程序和/或 32 位操作系统中使用 64 位库。您必须部署您的应用程序 x64。

于 2011-12-16T18:58:48.787 回答
0

试试这个代码。不确定它会起作用。但值得一试。

Desktop desktop = null;
if (Desktop.isDesktopSupported()) 
{
    desktop = Desktop.getDesktop();
}
String sysroot = System.getenv("SystemRoot");
desktop.open(new File(sysroot+"/system32/osk.exe"));

我是这个桌面类的新手,我想知道这个类是否能解决问题;)

于 2011-12-14T11:19:00.667 回答