运行可执行jar文件时发生致命SIGSEGV错误

时间:2019-04-20 10:57:50

标签: java linux swing jar executable-jar

我使用Ubuntu 16.04,这是$ java -version的结果:

openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

我有一个简单的代码,可以在Eclipse中成功运行它:

public static void main(String[] args) throws IOException {
    JFrame frame = new JFrame("Merge Operation");
    frame.setSize(390, 300);
    frame.setLocation(100, 150);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JFrame.setDefaultLookAndFeelDecorated(true);
    JButton startButton = new JButton("Star");
    startButton.setBounds(50, 50, 50, 50);
    frame.add(startButton);
    frame.setLayout(null);
    frame.setVisible(true);
}

我还从中创建了一个可执行文件.jar。但是,当我在终端中运行它时,JRE会检测到fatal error。尽管我在评论frame.add(startButton);时可以成功运行.jar文件。

什么原因导致该错误?我该如何解决?

这是错误日志的一部分:

  

--------------- SUMMA R Y ------------

     

命令行:test_swing.jar

     

主机:Intel(R)CoreTM i7-5820K CPU @ 3.30GHz,12核,7G,Ubuntu   16.04.6 LTS时间:2019年4月20日星期六15:20:58 +0430经过时间:0秒(0d 0h 0m 0s)

     

----------------- T H R E A D ---------------

     

当前线程(0x00007f872040f000):JavaThread“ AWT-EventQueue-0”   [_thread_in_native,id = 9831,   堆栈(0x00007f865f3c7000,0x00007f865f4c8000)]

     

堆栈:[0x00007f865f3c7000,0x00007f865f4c8000],   sp = 0x00007f865f4c15b0,可用空间= 1001k本机帧:(J =已编译   Java代码,j =解释后的代码,Vv = VM代码,C =本机代码)C   [libjava.so + 0x1d009] JNU_GetEnv + 0x19 C [libfontmanager.so + 0x33f8e] C   [libfreetype.so.6 + 0x14d2b] FT_Stream_Seek + 0x1b

     

Java框架:(J =编译的Java代码,j =解释的,Vv = VM代码)j   sun.font.FreetypeFontScaler.initNativeScaler(Lsun / font / Font2D; IIZI)J + 0   java.desktop@9-internal j   sun.font.FreetypeFontScaler。(Lsun / font / Font2D; IZI)V + 26   java.desktop@9-internal v〜StubRoutines :: call_stub j   sun.reflect.NativeConstructorAccessorImpl.newInstance0(Ljava / lang / reflect / Constructor; [Ljava / lang / Object;)Ljava / lang / Object; +0   java.base@9-internal j   sun.reflect.NativeConstructorAccessorImpl.newInstance([Ljava / lang / Object;)Ljava / lang / Object; +85   java.base@9-internal j   sun.reflect.DelegatingConstructorAccessorImpl.newInstance([Ljava / lang / Object;)Ljava / lang / Object; +5   java.base@9-internal j   java.lang.reflect.Constructor.newInstance([Ljava / lang / Object;)Ljava / lang / Object; +65   java.base@9-internal j   sun.font.FontScaler.getScaler(Lsun / font / Font2D; IZI)Lsun / font / FontScaler; +39   java.desktop@9-internal j   sun.font.TrueTypeFont.getScaler()Lsun / font / FontScaler; +21   java.desktop@9-internal j   sun.font.FileFontStrike。(Lsun / font / FileFont; Lsun / font / FontStrikeDesc;)V + 204   java.desktop@9-internal j   sun.font.FileFont.createStrike(Lsun / font / FontStrikeDesc;)Lsun / font / FontStrike; +18   java.desktop@9-internal j   sun.font.Font2D.getStrike(Lsun / font / FontStrikeDesc; Z)Lsun / font / FontStrike; +92   java.desktop@9-internal j   sun.font.Font2D.getStrike(Lsun / font / FontStrikeDesc;)Lsun / font / FontStrike; +3   java.desktop@9-internal j   sun.font.CompositeStrike.getStrikeForSlot(I)Lsun / font / PhysicalStrike; +23   java.desktop@9-internal j   sun.font.CompositeStrike.getFontMetrics()Lsun / font / StrikeMetrics; +31   java.desktop@9-internal j   sun.font.FontDesignMetrics.initMatrixAndMetrics()V + 28   java.desktop@9-internal j   sun.font.FontDesignMetrics。(Ljava / awt / Font; Ljava / awt / font / FontRenderContext;)V + 62   java.desktop@9-internal j   sun.font.FontDesignMetrics.getMetrics(Ljava / awt / Font; Ljava / awt / font / FontRenderContext;)Lsun / font / FontDesignMetrics; +128   java.desktop@9-internal j   sun.swing.SwingUtilities2.getFontMetrics(Ljavax / swing / JComponent; Ljava / awt / Font;)Ljava / awt / FontMetrics; +15   java.desktop@9-internal j   javax.swing.JComponent.getFontMetrics(Ljava / awt / Font;)Ljava / awt / FontMetrics; +2   java.desktop@9-internal j   sun.swing.SwingUtilities2.getFontMetrics(Ljavax / swing / JComponent; Ljava / awt / Graphics; Ljava / awt / Font;)Ljava / awt / FontMetrics; +6   java.desktop@9-internal j   sun.swing.SwingUtilities2.getFontMetrics(Ljavax / swing / JComponent; Ljava / awt / Graphics;)Ljava / awt / FontMetrics; +6   java.desktop@9-internal j   javax.swing.plaf.basic.BasicButtonUI.paint(Ljava / awt / Graphics; Ljavax / swing / JComponent;)V + 15   java.desktop@9-internal j   javax.swing.plaf.metal.MetalButtonUI.update(Ljava / awt / Graphics; Ljavax / swing / JComponent;)V + 86   java.desktop@9-internal j   javax.swing.JComponent.paintComponent(Ljava / awt / Graphics;)V + 26   java.desktop@9-internal j   javax.swing.JComponent.paint(Ljava / awt / Graphics;)V + 286   java.desktop@9-internal j   javax.swing.JComponent.paintChildren(Ljava / awt / Graphics;)V + 501   java.desktop@9-internal j   javax.swing.JComponent.paint(Ljava / awt / Graphics;)V + 318   java.desktop@9-internal j   javax.swing.JComponent.paintChildren(Ljava / awt / Graphics;)V + 501   java.desktop@9-internal j   javax.swing.JComponent.paint(Ljava / awt / Graphics;)V + 318   java.desktop@9-internal j   javax.swing.JLayeredPane.paint(Ljava / awt / Graphics;)V + 73   java.desktop@9-internal j   javax.swing.JComponent.paintChildren(Ljava / awt / Graphics;)V + 501   java.desktop@9-internal j   javax.swing.JComponent.paintToOffscreen(Ljava / awt / Graphics; IIIIII)V + 72   java.desktop@9-internal j   javax.swing.BufferStrategyPaintManager.paint(Ljavax / swing / JComponent; Ljavax / swing / JComponent; Ljava / awt / Graphics; IIII)Z + 164   java.desktop@9-internal j   javax.swing.RepaintManager.paint(Ljavax / swing / JComponent; Ljavax / swing / JComponent; Ljava / awt / Graphics; IIII)V + 51   java.desktop@9-internal j   javax.swing.JComponent.paint(Ljava / awt / Graphics;)V + 221   java.desktop@9-internal j   java.awt.GraphicsCallback $ PaintCallback.run(Ljava / awt / Component; Ljava / awt / Graphics;)V + 2   java.desktop@9-internal j   sun.awt.SunGraphicsCallback.runOneComponent(Ljava / awt / Component; Ljava / awt / Rectangle; Ljava / awt / Graphics; Ljava / awt / Shape; I)V + 155   java.desktop@9-internal j   sun.awt.SunGraphicsCallback.runComponents([Ljava / awt / Component; Ljava / awt / Graphics; I)V + 157   java.desktop@9-internal j   java.awt.Container.paint(Ljava / awt / Graphics;)V + 58   java.desktop@9-internal j   java.awt.Window.paint(Ljava / awt / Graphics;)V + 68 java.desktop@9-internal   j javax.swing.RepaintManager $ 4.run()Ljava / lang / Void; +142   java.desktop@9-internal j   javax.swing.RepaintManager $ 4.run()Ljava / lang / Object; +1   java.desktop@9-internal v〜StubRoutines :: call_stub j   java.security.AccessController.doPrivileged(Ljava / security / PrivilegedAction; Ljava / security / AccessControlContext;)Ljava / lang / Object; +0   java.base@9-internal j   java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(Ljava / security / PrivilegedAction; Ljava / security / AccessControlContext; Ljava / security / AccessControlContext;)Ljava / lang / Object; +18   java.base@9-internal j   javax.swing.RepaintManager.paintDirtyRegions(Ljava / util / Map;)V + 154   java.desktop@9-internal j   javax.swing.RepaintManager.paintDirtyRegions()V + 46   java.desktop@9-internal j   javax.swing.RepaintManager.prePaintDirtyRegions()V + 73   java.desktop@9-internal j   javax.swing.RepaintManager.access $ 1200(Ljavax / swing / RepaintManager;)V + 1   java.desktop@9-internal j   javax.swing.RepaintManager $ ProcessingRunnable.run()V + 37   java.desktop@9-internal j   java.awt.event.InvocationEvent.dispatch()V + 47 java.desktop@9-internal   Ĵ   java.awt.EventQueue.dispatchEventImpl(Ljava / awt / AWTEvent; Ljava / lang / Object;)V + 21   java.desktop@9-internal j   java.awt.EventQueue.access $ 500(Ljava / awt / EventQueue; Ljava / awt / AWTEvent; Ljava / lang / Object;)V + 3   java.desktop@9-internal j   java.awt.EventQueue $ 3.run()Ljava / lang / Void; +32 java.desktop@9-internal   j java.awt.EventQueue $ 3.run()Ljava / lang / Object; +1   java.desktop@9-internal v〜StubRoutines :: call_stub j   java.security.AccessController.doPrivileged(Ljava / security / PrivilegedAction; Ljava / security / AccessControlContext;)Ljava / lang / Object; +0   java.base@9-internal j   java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(Ljava / security / PrivilegedAction; Ljava / security / AccessControlContext; Ljava / security / AccessControlContext;)Ljava / lang / Object; +18   java.base@9-internal j   java.awt.EventQueue.dispatchEvent(Ljava / awt / AWTEvent;)V + 46   java.desktop@9-internal j   java.awt.EventDispatchThread.pumpOneEventForFilters(I)V + 183   java.desktop@9-internal j   java.awt.EventDispatchThread.pumpEventsForFilter(ILjava / awt / Conditional; Ljava / awt / EventFilter;)V + 35   java.desktop@9-internal j   java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava / awt / Conditional; Ljava / awt / Component;)V + 11   java.desktop@9-internal j   java.awt.EventDispatchThread.pumpEvents(ILjava / awt / Conditional;)V + 4   java.desktop@9-internal j   java.awt.EventDispatchThread.pumpEvents(Ljava / awt / Conditional;)V + 3   java.desktop@9-internal j java.awt.EventDispatchThread.run()V + 9   java.desktop@9-internal v〜StubRoutines :: call_stub

     

siginfo:si_signo:11(SIGSEGV),si_code:1(SEGV_MAPERR),si_addr:   0x0000000000000000

     

注册到内存的映射:

     

RAX = 0x0000000000000000是一个未知值RBX = 0x0000000000000000是   未知值RCX = 0x0000000000000000是未知值   RDX = 0x0000000000010002是一个未知值RSP = 0x00007f865f4c15b0是   指向堆栈的线程:0x00007f872040f000   RBP = 0x00007f865f4c15c0指向线程的堆栈:   0x00007f872040f000 RSI = 0x0000000000010002是未知值   RDI = 0x0000000000000000是一个未知值R8 = 0x0000000000000000是   未知值R9 = 0x0000000000000000是未知值   R10 = 0x00000000000001db是未知值R11 = 0x00007f871fdefff0:   JNU_GetEnv + 0x0000000000000000在   /usr/lib/jvm/java-9-openjdk-amd64/lib/amd64/libjava.so位于   0x00007f871fdd3000 R12 = 0x00007f8648031620是未知值   R13 = 0x0000000000000000是一个未知值R14 = 0x0000000000000000是   未知值R15 = 0x00007f8648031680是未知值

     

寄存器:RAX = 0x0000000000000000,RBX = 0x0000000000000000,   RCX = 0x0000000000000000,RDX = 0x0000000000010002 RSP = 0x00007f865f4c15b0,   RBP = 0x00007f865f4c15c0,RSI = 0x0000000000010002,RDI = 0x0000000000000000   R8 = 0x0000000000000000,R9 = 0x0000000000000000,   R10 = 0x00000000000001db,R11 = 0x00007f871fdefff0 R12 = 0x00007f8648031620,   R13 = 0x0000000000000000,R14 = 0x0000000000000000,R15 = 0x00007f8648031680   RIP = 0x00007f871fdf0009,EFLAGS = 0x0000000000010246,   CSGSFS = 0x002b000000000033,ERR = 0x0000000000000004
  TRAPNO = 0x000000000000000e

     

堆栈顶部:(sp = 0x00007f865f4c15b0)0x00007f865f4c15b0:
  0000000000000000 9ba8cd26fca30900 0x00007f865f4c15c0:
  00007f865f4c1600 00007f8670326f8e 0x00007f865f4c15d0:
  00007f8648021430 00007f8648031620 0x00007f865f4c15e0:
  0000000000000000 0000000000000000 0x00007f865f4c15f0:
  00007f8648031620 00007f8648031680 0x00007f865f4c1600:
  0000000000000000 00007f867005dd2b 0x00007f865f4c1610:
  0000000000000000 00007f86702efd80 0x00007f865f4c1620:
  0000000000000000 00007f86700718e0 0x00007f865f4c1630:
  0000000000000002 0000003200000008 0x00007f865f4c1640:
  0000000000000000 0000000000000000 0x00007f865f4c1650:
  0000006e0000005b 0000000000000000 0x00007f865f4c1660:
  0000000000000000 0000007c00000077 0x00007f865f4c1670:
  0000000000000000 0000000000000000 0x00007f865f4c1680:
  0000000000000000 0000000000000000 0x00007f865f4c1690:
  0000000000000000 00007f8648000020 0x00007f865f4c16a0:
  0000000000000070 00007f865f4c1754 0x00007f865f4c16b0:
  00007f8648021430 00007f8648031680 0x00007f865f4c16c0:
  00007f865f4c1754 00007f8726554184 0x00007f865f4c16d0:
  0000000000000000 00007f865f4c1704 0x00007f865f4c16e0:
  00007f86702ec9e0 9ba8cd26fca30900 0x00007f865f4c16f0:
  0000000000000070 00007f86480210b0 0x00007f865f4c1700:
  00007f86702ec9e0 00007f865f4c1818 0x00007f865f4c1710:
  00007f8648021430 00007f8648031680 0x00007f865f4c1720:
  00007f8648031bb0 00007f86700604c2 0x00007f865f4c1730:
  0000000100000000 00007f865f4c1820 0x00007f865f4c1740:
  0000000000000000 0000000000000000 0x00007f865f4c1750:
  000000005f4c1818 9ba8cd26fca30900 0x00007f865f4c1760:
  00007f86480210b0 00007f865f4c1820 0x00007f865f4c1770:
  0000000000000000 00007f8648021358 0x00007f865f4c1780:
  00007f865f4c1a20 00007f86480212b8 0x00007f865f4c1790:
  00007f8648021430 00007f8670062581 0x00007f865f4c17a0:
  00007f865f4c1820 00007f8670062376

     

指令:(pc = 0x00007f871fdf0009)0x00007f871fdeffe9:ff eb ea   0f 1f 40 00 55 89 f2 48 89 e5 48 83 ec 0x00007f871fdefff9:10 64 48   8b 04 25 28 00 00 00 48 89 45 f8 31 c0 0x00007f871fdf0009:48 8b 07   48 8d 75 f0 ff 50 30 48 8b 4d f8 64 48 0x00007f871fdf0019:33 0c 25   28 00 00 00 48 8b 45 f0 75 02 c9 c3 e8

0 个答案:

没有答案