使用Intellij运行时,Desktop.getDesktop()会崩溃JVM

时间:2014-03-12 03:30:24

标签: java intellij-idea jvm jvm-crash

请考虑以下代码段:

import java.awt.*;
import java.io.*;

public class V
{
    public static void main(String[] args)
    {
        if (Desktop.isDesktopSupported())
            try
            {
                Desktop.getDesktop().open(new File("C:\\")); //Or any file/folder
            } catch (IOException ex)
            {
                ex.printStackTrace();
            }
    }
}

如果我通过命令提示符编译并运行它,它可以正常工作并按预期打开文件夹。

但是,如果我打开同一个类并通过Intellij运行它会导致JVM崩溃。

即想出这个屏幕

enter image description here

错误详情

Problem signature:
  Problem Event Name:   BEX
  Application Name: java.exe
  Application Version:  7.0.210.11
  Application Timestamp:    515d68ea
  Fault Module Name:    StackHash_d4e2
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   00000000
  Exception Offset: 6a2e6363
  Exception Code:   c0000005
  Exception Data:   00000008
  OS Version:   6.1.7601.2.1.0.256.48
  Locale ID:    5129
  Additional Information 1: d4e2
  Additional Information 2: d4e23849915837b7cd6589c72ebf3a65    
  Additional Information 3: 4c98
  Additional Information 4: 4c989ca1785510040bc407d74228ddb4

hs_err_pidxxxx.log文件生成此

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x4d81ff08, pid=7584, tid=3460
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) Client VM (23.21-b01 mixed mode windows-x86 )
# Problematic frame:
# C  0x4d81ff08
#

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

Current thread (0x498af400):  JavaThread "Swing-Shell" daemon [_thread_in_native, id=3460, stack(0x4d550000,0x4d5a0000)]

.
.
.

Stack: [0x4d550000,0x4d5a0000],  sp=0x4d59e9d0,  free space=314k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x4d81ff08

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.shell.Win32ShellFolder2.compareIDsByColumn(JJJI)I+0
j  sun.awt.shell.Win32ShellFolder2.access$3300(JJJI)I+6
j  sun.awt.shell.Win32ShellFolder2$ColumnComparator$1.call()Ljava/lang/Integer;+54
j  sun.awt.shell.Win32ShellFolder2$ColumnComparator$1.call()Ljava/lang/Object;+1
J  java.util.concurrent.FutureTask$Sync.innerRun()V
J  java.util.concurrent.FutureTask.run()V
j      java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j  java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j  sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run()V+7
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

如果有用,可以添加更多。

1 个答案:

答案 0 :(得分:0)

请尝试升级至Version 7 update 51。跟踪器中有一些关于崩溃的问题。

通常,如果JVM崩溃且部署的代码不使用本机库,请先尝试升级。