java - Can't run JavaFx code from Eclipse -


i found code on site oracle can't launch eclipse it's saying me "unable launch". have installed jdk 8 doesn't work...

anybody have solution please ? :p

public class swingfx extends application {  @override public void start (stage stage) {     final swingnode swingnode = new swingnode();      createswingcontent(swingnode);      stackpane pane = new stackpane();     pane.getchildren().add(swingnode);      stage.settitle("swing in javafx");     stage.setscene(new scene(pane, 250, 150));     stage.show();     }  private void createswingcontent(final swingnode swingnode) {     swingutilities.invokelater(new runnable() {         @override         public void run() {             swingnode.setcontent(new jbutton("click me!"));         }     }); } } 

link website found code : https://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm

in java 8, can directly launch javafx.application.application subclass if doesn't have main(string[] args) method. issue current version of eclipse doesn't check this, , (at least in context menus) checks whether main(...) method exists. allow run eclipse, can either add main(...) method yourself:

public class swingfx extends application {      @override     public void start(stage stage) {         // ...     }      public static void main(string[] args) {         launch(args);     } } 

or, can directly instruct eclipse run "run configurations" wizard. swingfx class selected, choose "run" menu, , "run configurations". in "main" tab make sure correct class name appears (i.e. "swingfx") , press "run" button.

once you've set up, green "run" button on toolbar (in java perspective) run application again, until run else.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -