gpt4 book ai didi

JavaFX-JFXpanel 错误?

转载 作者:行者123 更新时间:2023-12-01 12:51:04 25 4
gpt4 key购买 nike

public class JavaApplication3 {

/**
* @param args the command line arguments
*/


public void initAndShowGUI() {
// This method is invoked on the EDT thread
JFrame frame = new JFrame("Swing and JavaFX");
final JFXPanel fxPanel = new JFXPanel();
frame.add(fxPanel);
frame.setSize(300, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Platform.runLater(new Runnable() {
@Override
public void run() {
initFX(fxPanel);
}
});
}

private void initFX(JFXPanel fxPanel) {
// This method is invoked on the JavaFX thread
Scene scene = createScene();
fxPanel.setScene(scene);
}

private Scene createScene() {
Group root = new Group();
Scene scene = new Scene(root, Color.ALICEBLUE);
WebView browser;

browser = new WebView();
//browser.setContextMenuEnabled(false);
browser.autosize();
WebEngine webEngine = browser.getEngine();
String Qlink = "https://www.google.ca";
webEngine.load(Qlink);

root.getChildren().add(browser);
return (scene);

}



public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
System.setProperty("http.proxyHost","10.10.6.61");
System.setProperty("http.proxyPort","6666");
System.setProperty("https.proxyHost","10.10.6.61");
System.setProperty("https.proxyPort","6666");
JavaApplication3 j = new JavaApplication3();
j.initAndShowGUI();
}
});
}
}

这是与oracle示例代码90%相同的程序。要么我刷新页面两次,要么等待一段时间,JVM 就会自行崩溃。我究竟做错了什么,才会出现这样的结果?请指出。它很容易复制。我使用的是java7u22,jfxrt是jre默认包含的。非常感谢您的帮助!

编辑:我将发布 IDE 上显示的错误,该错误很长。如果您要求,我还将提供核心转储日志文件。抱歉,我的语法可能会让您难以理解我的意思。

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005c2728e3, pid=812, tid=5280
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [glass.dll+0x128e3]
#
# Core dump written. Default location: C:\Users\robin.ASIGRA\Documents\NetBeansProjects\JavaApplication3\hs_err_pid812.mdmp
#
# An error report file with more information is saved as:
# C:\Users\robin.ASIGRA\Documents\NetBeansProjects\JavaApplication3\hs_err_pid812.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

2014年6月13日更新

我的操作系统是window server R2 2008,java版本是7我尝试将java版本更新到8,但问题仍然存在。此应用程序必须在java7环境中构建。我发现它是Windows Server R2 2008上java7的bug,并且有一个解决方案。

This issue occurs on Windows Server 2008 R2 SP1 and Java 7u45 (JavaFX 2.2.45). I've solved it enabling Desktop Experience feature (on the remote server, go to Administrative Tools --> Server Manager). Pay attention to the fact that this feature enables also Windows Defender service and Microsoft doc doesn't report it.

完成此操作后,问题就解决了。

最佳答案

更新

正如原始发布者在其问题更新中所指出的,此问题特定于在 Windows R2 2008 服务器上使用旧版本的 Java,该问题已在 Java 8 中作为 RT-23456 Java crashes on Windows 2008 R2 trying to run Java FX demo 'Ensemble' 的一部分得到解决。

为我工作

我在 Win 7、Java 8u20b11 上运行了您的应用程序(已注释掉代理设置),它对我有用。

您可以下载 Java 8 development release 来获取修复该问题的 Java 版本。如果您必须坚持使用 Java 7(不真正推荐),那么您可以应用问题更新中所述的解决方法。

关于JavaFX-JFXpanel 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24212042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com