Home pageFind It!Contact PJAPJA documentation


 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject getFontPath() fires in spite of -Djava.awt.fonts is set


Member since : Jan 6, 2004
Messages : 1
 Jan 6, 2004 at 11:16 PM

I moved from java 1.3 to java 1.4, but I can't use headless mode, because
graphics generating part of my application strongly depends on awt.frames.
In 1.3 I used PJA.
So I decided to use PJA 2.5, but it throws an exception:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xC1241C44

Current Java thread:
"ExecuteThread: '23' for queue: 'weblogic.kernel.Default'" daemon prio=4
tid=0x00260dd0 nid=34 lwp_id=20581 runnable [0x67868000..0x67867500]
at sun.awt.font.NativeFontWrapper.getFontPath(Native Method)
- locked <0x6a66c2c8> (a java.lang.Class)
...and so on
I found in PJA docs that parameter -Djava.awt.fonts helps in my case: (this
property must be defined to avoid calling the getFontPath () native method
of the class NativeFontWrapper)
I have that parameter set:
-Djava.awt.fonts=/home/bea/jdk141_02/jre/lib/fonts but the native exception
still occurs.

So I started to investigate the exception stack. I found out that there a
piece of interesting code in the class SunGraphicsEnvironment:
fontPath = System.getProperty("sun.java2d.fontpath");
if(fontPath == null || fontPath.length() == 0)
fontPath = getPlatformFontPath(flag);
fontPath = s + File.pathSeparator + fontPath;
so I thought that mayby when I replace -Djava.awt.fonts with
-Dsun.java2d.fontpath it will be OK. But the exception still occurs.
Can anyone help me?



Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Jan 21, 2004 at 7:25 PM
Did you set the java2d.font.usePlatformFont system property to false ?
Manu (moderator/modérateur)


Location : Spain
Member since : Aug 11, 2004
Messages : 2
 Aug 11, 2004 at 6:54 PM

I have EXACTLY the same problem. It worked fine with J2SE 1.3.1, but throws that exception when executing in 1.4.2.

Did you find a solution?
Can anyone give me a clue?


O.S : HP-UX 11
J2SE: 1.4.2_02
PJA : 2.5
System properties:


I get the following exception:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xC3A4C470 Function=XGetFontPath

Current Java thread:
"main" prio=3 tid=00045988 nid=1 lwp_id=35226 runnable [0x7f7f3000..0x7f7f1cc0]
at sun.awt.font.NativeFontWrapper.getFontPath(Native Method)
- locked <5ec4e4b8> (a java.lang.Class)
- locked <72d4afc8> (a com.eteks.java2d.PJAGraphicsEnvironment)
at java.security.AccessController.doPrivileged(Native Method)
at (...)

Dynamic libraries:

Heap at VM Abort:
def new generation total 118016K, used 34374K [70c00000, 78c00000,
eden space 104960K, 32% used [70c00000, 72d91870, 77280000)
from space 13056K, 0% used [77280000, 77280000, 77f40000)
to space 13056K, 0% used [77f40000, 77f40000, 78c00000)
tenured generation total 262144K, used 147882K [60c00000, 70c00000,
the space 262144K, 56% used [60c00000, 69c6a910, 69c6aa00, 70c00000) compacting perm gen total 33280K, used 33084K [5cc00000, 5ec80000,
the space 33280K, 99% used [5cc00000, 5ec4f2f0, 5ec4f400, 5ec80000)

Local Time = Wed Aug 11 14:01:46 2004
Elapsed Time = 229
# The exception above was detected in native code outside the VM # # Java VM: Java HotSpot(TM) Server VM (1.4.2 PA2.0 (aCC_AP) mixed mode)


It is very urgent. Thanks in advance,


Location : Spain
Member since : Aug 11, 2004
Messages : 2
 Aug 13, 2004 at 11:20 AM
Hello everybody.

At last!!!!
We finally got it working on J2SE 1.4.2 over a headless HP-UX 11.
We have had to patch the PJAGraphicsEnvironment class in order to achieve the workaround.

1. As Kuzo said, in J2SE 1.4, the "java.awt.fonts" system property is not longer used; they replaced it with the "sun.java2d.fontpath".
2. But this is not sufficient, because the getFontPath() is also invoked later in the code inside SunGraphicsEnvironment (version J2SE 1.4). So, after studying the SunGraphicsEnvironment code, we found that the registeredAllPaths protected variable is used as the condition to invoke getFontPath().

3. So we have implemented the registerFontsWithPlatform() method in PJAGraphicsEnvironment.java to override it (it is empty in the parent class AND is called just before getFontPath()

This patch works with headless environments with J2SE 1.4.x and J2SE 1.3.x.

Here is the method to be added to PJAGraphicsEnvironment.java (I called it 2.5b):


* Overrides implementation of the (empty) method of SunGraphicsEnvironment.
* <p>Sets boolean variables so getFontPath() won't be called.
* <p>Also, if "sun.java2d.fontpath" system property is not set,
* uses the "java.awt.fonts" system property value.
* <p>This way supports J2SE 1.4.1 with the same "java.awt.fonts" requirement as J2SE 1.3
* @since PJA2.5b
protected void registerFontsWithPlatform(String s) {
// Added by JES
try {

// This is the variable checked in J2SE 1.4
// after the invocation of this method
registeredAllPaths = true;
loadNativeFonts = false;

// In J2SE 1.4,
// fontPath has been set to System.getProperty("sun.java2d.fontpath")
// before invoking this method.
// If not set, sets to System.getProperty("java.awt.fonts"),
// to enable J2SE 1.4 compatibility without changing the requirements
// stablished in the PJA documentation
if (fontPath==null || fontPath.length() == 0) {
fontPath = System.getProperty("sun.java2d.fontpath");
catch (Exception e) { e.printStackTrace();}


I think this should be added to new releases of the product.

Hope this also helps to other developers.


Location : Iowa City, Iowa, U.S.A.
Member since : May 13, 2003
Messages : 4
 Sep 3, 2004 at 5:49 PM
I ran into the same problem when I was migrating from WebSphere 5.0 (JDK 1.3.1) to WebSphere 5.1 (J2SE 1.4.2) in HP-UX and I have fixed the problem using the above patch.

There are a couple of points about this patch that I'd like to share:

1. When I used the J2SE 1.4.1 that comes with IBM WSAD 5.1 (Windows), I had a compiling error saying that the variable registeredAllPaths is not defined. I had to comment out the statement "registeredAllPaths = true;" in order to compile. The resulted JAR files are working fine in WSAD 5.1.

2. Using J2SE 1.4.2 in HP-UX, the variable is defined and there is no compiling error.

3. I'm not sure if the varible is not defined just in the Windows platform or J2SE 1.4.1. More testing is needed.

4. I would replace the statement:

fontPath = System.getProperty("sun.java2d.fontpath");


fontPath = System.getProperty("java.awt.fonts");

so that I would not have to change any server configuration. Otherwise, I would have to set the system property "sun.java2d.fontpath" to the font path.


Location : USA
Member since : Sep 26, 2006
Messages : 1
 Sep 26, 2006 at 11:35 PM
If you run your program as web-based app using Tomcat on Unix/Linux with JDK 1.4+, you can add this line into the file tomcat/bin/catalina.sh:

CATALINA_OPTS="$CATALINA_OPTS -Dsun.java2d.fontpath=/etc/java1.4/jre/lib/fonts"

suppose that the path to your JDK 1.4 is /etc/java1.4

It will solve the error.
Or if you run Java program from command line, you can add this part to Java command: "-Dsun.java2d.fontpath=/etc/java1.4/jre/lib/fonts"

for example:
java -Dsun.java2d.fontpath=/etc/java1.4/jre/lib/fonts MyProgram

So you don't have to change your Java code.

I guess that the main point here is that you need to add the part "-Dsun.java2d.fontpath=/etc/java1.4/jre/lib/fonts" to whatever JDK which is used to run apps, so if you use Websphere, Weblogic, JBoss or any other app server, you just need to add that part in to the command line that is used to start up JVM for the server or app.

It will prevent Java from looking for fonts in X-Server. It is needed only on Unix environments, because on Window, graphics server is always running.

Chau Hong Linh.

Home pageFind It!ContactTop

© Copyrights 1997-2014 eTeks - All rights reserved

PJAPJA documentation