0

I have a simple JavaFX program, code is as following:

package myapp;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class MyApplication extends Application {

    @Override
    public void start(Stage primaryStage) {
        BorderPane p = new BorderPane();
        Text t = new Text("Hello FX");
        t.setFont(Font.font("Arial", 60));
        t.setEffect(new DropShadow(2, 3, 3, Color.RED));
        p.setCenter(t);


        Button button2 = new Button("Accept");
        p.setRight(button2);

        Label label1 = new Label("Name:");
        TextField textField = new TextField();
        HBox hb = new HBox();
        hb.getChildren().addAll(label1, textField);
        hb.setSpacing(10);
        p.setBottom(hb);

        primaryStage.setScene(new Scene(p));
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}

It runs perfect on my machine. However when I export it as a jar file and copy it to my cowoker's machine, and run it with the command java -jar <file_name>.It can't run normally and throw an exception as following:

Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\
HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\H
P\Unified Functional Testing\bin\java_shared\classes\jasmine.jar"
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.
lang.VerifyError: Expecting a stackmap frame at branch target 12
Exception Details:
  Location:
    javafx/application/Application.<init>()V @0: ldc
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 12a8 12aa 01b8 00b0 57a7 0004 572a b700
    0x0000010: 192a 01b5 001a b1
  Exception Handler Table:
    bci [0, 9] => handler: 12

        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithA
rgs$156(LauncherImpl.java:352)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Platfor
mImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.
java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformI
mpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatch
er.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.ja
va:191)
        at java.lang.Thread.run(Thread.java:745)
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Lau
ncherImpl.java:383)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImp
l.java:328)
        ... 5 more

Can anyone help me out of this issue? really appreciate it.

kenshinji
  • 2,021
  • 4
  • 25
  • 39
  • 1
    http://stackoverflow.com/questions/15122890/java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-1-7 – 001 Dec 23 '16 at 02:15

1 Answers1

0

Thanks to @Johnny Mopp, I find a simple workaround is to add a JVM argument -noverify to make my application running.

kenshinji
  • 2,021
  • 4
  • 25
  • 39