Consider this code snippet:

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();
            }
    }
}

If I compile and run this through a command prompt it works fine and opens the folder as expected.

However if I then open the same class and run it through Intellij it causes the JVM to crash.

i.e Comes up with this screen

enter image description here

Error details

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

The hs_err_pidxxxx.log file produces this

#
# 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

Can add more if that's useful.

有帮助吗?

解决方案

Please try an upgrade to Version 7 update 51. There have been some Issues at the tracker about crashes.

In general, if you JVM crashes and your deployed code don't use native libraries, try an upgrade first.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top