I am trying to open a webpage in javafx webview . Its throwing a fatal error exception
Error is this-
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6e98299b, pid=4116, tid=4224
JRE version: 7.0_10-b18 Java VM: Java HotSpot(TM) Client VM (23.6-b04 mixed mode, sharing windows-x86 ) Problematic frame: V [jvm.dll+0xb299b]
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
An error report file with more information is saved as: C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\NetCheck\hs_err_pid4116.log
If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp
What is the reason for the above error , I am using the following code.
import javax.swing.*;
import java.awt.*;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
public class Browser extends javax.swing.JFrame
{
JFXPanel fxpanel;
WebEngine eng;
public Browser() {
initComponents();
setLayout(null);
fxpanel=new JFXPanel();
add(fxpanel);
fxpanel.setBounds(50,50,700,500);
setBounds(0,0,1024,768);
}
private void initFx(final JFXPanel fxpanel)
{
try
{
Group group= new Group();
Scene scene= new Scene(group);
fxpanel.setScene(scene);
WebView webview = new WebView ();
group.getChildren().add(webview);
webview.setMinSize(700,500);
webview.setMaxSize(700,500);
webview.setVisible(true);
eng= webview.getEngine();
eng.setJavaScriptEnabled(true);
eng.load("http://www.google.com");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public static void main(String args[])
{
Browser b1= new Browser();
b1.show();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
Platform.runLater(new Runnable() {
public void run()
{
initFx(fxpanel);
}}
);
}