If I close applet with JavaFX content (so applet is using EDT and JavaFX thread) the jp2launcher.exe continues run for almost 1 minute so that applet cannot be easily started again (as soon as it is not recognized as new instance – after browser close etc.).
I have search Google but I have found no solution. I have found only very similar issue – https://bugs.openjdk.java.net/browse/JDK-8051030.
Another solution would be if the applet could start on lasting jp2launcher.exe but it cannot. It is simply not invoked. Only init method of JApplet is overriden.
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
import java.awt.Graphics;
import javafx.embed.swing.JFXPanel;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.animation.Timeline;
/*<applet code="sample" width=600 height=600></applet>*/
public class sample extends JApplet{
protected Scene scene;
protected Group group;
Timeline timeline;
JFXPanel fxPanel;
@Override
public final void init(){initSwing();}
private void initSwing(){
fxPanel = new JFXPanel();
add(fxPanel);
Platform.runLater(() ->{initFX(fxPanel);});
}
private void initFX(JFXPanel fxPanel){
timeline=new Timeline();
group=new Group();
scene=new Scene(group);
}
@Override
public void start(){
try{SwingUtilities.invokeAndWait(this::initSwing);}
catch(java.lang.InterruptedException|java.lang.reflect.InvocationTargetException e){}}
}