Home pageFind It!Contact PJAPJA documentation

PJA

 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 Still getting headless exception when trying to run JFrame class in a jar file from a tomcat server

susan

Location : Perth
Member since : Apr 21, 2004
Messages : 1
 Jul 10, 2004 at 6:40 AM
Hello,

As I do not run my own web host but rather am dependent upon support to make changes to any command line parameters and due to other considerations I have attempted to set PJA system variables within a JFrame class within an executable jar file located on the server, i.e.

try {
dim = Toolkit.getDefaultToolkit().getScreenSize() ;
} catch ( Exception noenv ) {

try {
System.setProperty("awt.toolkit", "com.eteks.awt.PJAToolkit") ;
System.setProperty("java.awt.graphicsenv", "com.eteks.java2D.PJAGraphicsEnvironment") ;
System.setProperty("java.awt.fonts", "/Dialog.pjaf") ;
dim = PJAToolkit.getDefaultToolkit().getScreenSize() ;

} catch ( Exception nenv ) {

JOptionPane.showMessageDialog(new JFrame(), "Cannot access server graphics environment.\nTry another HTML or JSP format which does not require server graphics to be available.\n" + nenv + "\n", "Tester", JOptionPane.ERROR_MESSAGE);
this.dispose() ;
}
}


This code is the first thing within the JFrame class. I have also added "pja.jar" to the WEB-INF/classes/lib directory and the following line:

<%@ page import="com.eteks.awt.*" %>

in the JSP which runs the JFrame class. This approach appears to be running fine when I run it in a Windows environment (I have removed pja.jar from all ext directories so that it can only be finding pja classes under WEB-INF or within the jar itself) but still fails with a headless exception on the Linix web host. In both cases the JVM is 1.3.1.

Does anyone have any clues as to how I can achieve this? Ideally, I would like to retain the pja references in the jar file so that they are migratable without any changes to the system environments.

---
http://www.hexworx.com


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation