Hello,
I have written a separate GUI part in Swing for my game. So when the player sets his user name and other settings, this Java application starts the other one using the exec() method. The problem is my game crashes immediately after startup, throwing out messages I only saw when binding native DLLs with JNI.
My other application (the game) does this: it loads all the settings and other stuff, then it creates a JFrame. The error occurs in the JFrame constructor, right before I call super():
public Game() { super("My game");
This is the code I’m using to start the game:
`
Process proc = Runtime.getRuntime().exec(
new String[] {“javaw”, “-cp”, “bin;.”, “com.mygame.Game”},
new String[] {“dd”},
new File(“D:\Tgame2”));
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null)
System.out.println(line);
`
This is the same as if I had written
javaw -cp bin;. com.mygame.Game dd
while being in the D:\Tgame2 directory.
This is the output I retrieved through the BufferedReader:
`Starting the game, press ESC to quit…
Loading settings… OK
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x3284C7D
Function=AWTIsHeadless+0x17AD
Library=D:\Java\jre\bin\awt.dll
Current Java thread:
at sun.awt.windows.WToolkit.init(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:231)
at java.lang.Thread.run(Thread.java:534)
Dynamic libraries:
0x00400000 - 0x00407000 D:\Java\bin\javaw.exe
0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F47000 C:\WINDOWS\system32\kernel32.dll
0x77DD0000 - 0x77E5D000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78087000 C:\WINDOWS\system32\RPCRT4.dll
0x77D40000 - 0x77DCD000 C:\WINDOWS\system32\USER32.dll
0x7F000000 - 0x7F042000 C:\WINDOWS\system32\GDI32.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll
0x76390000 - 0x763AC000 C:\WINDOWS\System32\IMM32.DLL
0x629C0000 - 0x629C8000 C:\WINDOWS\System32\LPK.DLL
0x72FA0000 - 0x72FFA000 C:\WINDOWS\System32\USP10.dll
0x5A800000 - 0x5A817000 C:\Program Files\Spyware Doctor\Tools\eg.dat
0x77120000 - 0x771AB000 C:\WINDOWS\system32\oleaut32.dll
0x4FEC0000 - 0x4FFE6000 C:\WINDOWS\system32\OLE32.DLL
0x5A000000 - 0x5A018000 C:\Program Files\Spyware Doctor\Tools\klg.dat
0x00A30000 - 0x00A4F000 C:\Program Files\Spyware Doctor\tools\swpg.dat
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
0x08000000 - 0x08138000 D:\Java\jre\bin\client\jvm.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x10000000 - 0x10007000 D:\Java\jre\bin\hpi.dll
0x76F90000 - 0x76FA0000 C:\WINDOWS\System32\Secur32.dll
0x003F0000 - 0x003FE000 D:\Java\jre\bin\verify.dll
0x00BF0000 - 0x00C09000 D:\Java\jre\bin\java.dll
0x00820000 - 0x0082D000 D:\Java\jre\bin\zip.dll
0x031F0000 - 0x032FF000 D:\Java\jre\bin\awt.dll
0x73000000 - 0x73023000 C:\WINDOWS\System32\WINSPOOL.DRV
0x03310000 - 0x03360000 D:\Java\jre\bin\fontmanager.dll
0x51000000 - 0x5104D000 C:\WINDOWS\System32\ddraw.dll
0x73BC0000 - 0x73BC6000 C:\WINDOWS\System32\DCIMAN32.dll
0x5C000000 - 0x5C0C8000 C:\WINDOWS\System32\D3DIM700.DLL
0x74720000 - 0x74764000 C:\WINDOWS\System32\MSCTF.dll
0x07450000 - 0x0747B000 C:\WINDOWS\System32\msctfime.ime
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
0x6D510000 - 0x6D58D000 C:\WINDOWS\system32\DBGHELP.dll
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
Heap at VM Abort:
Heap
def new generation total 576K, used 226K [0x10010000, 0x100b0000, 0x104f0000)
eden space 512K, 31% used [0x10010000, 0x10038998, 0x10090000)
from space 64K, 100% used [0x100a0000, 0x100b0000, 0x100b0000)
to space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000)
tenured generation total 1408K, used 85K [0x104f0000, 0x10650000, 0x14010000)
the space 1408K, 6% used [0x104f0000, 0x10505628, 0x10505800, 0x10650000)
compacting perm gen total 4096K, used 2309K [0x14010000, 0x14410000, 0x18010000)
the space 4096K, 56% used [0x14010000, 0x14251400, 0x14251400, 0x14410000)
Local Time = Tue Sep 12 18:10:56 2006
Elapsed Time = 1
The exception above was detected in native code outside the VM
Java VM: Java HotSpot™ Client VM (1.4.2_04-b05 mixed mode)
An error report file has been saved as hs_err_pid4144.log.
Please refer to the file for further information.
#`
As you can see from the first two lines, the game is working in the beginning (loading settings), but then it crashes when it needs to create a new JFrame. Also, the error is apparently in D:\Java\jre\bin\awt.dll
Any idea how I can fix this? Is there something special regarding to loading other Java GUI applications?

