LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2009, 06:59 AM   #1
akuma_linux
Member
 
Registered: Aug 2006
Distribution: Ubuntu, CentOS
Posts: 31

Rep: Reputation: 15
Java | Ubuntu 8.04 | java.awt.HeadlessException


Hello

I have an Ubuntu 8.04 machine running tomcat 5.5, and a java application which is showing an error :

Code:
An error occurred:

      java.awt.HeadlessException
This error only occurs on one page of the java app, the rest works fine.

Gnome / Xserver is installed and the DISPLAY variable is set to localhost:0.

My Questions are as follows -

1 - With this error, does it mean java is running in headless mode? If so, should headless mode not be set to false since a full graphical desktop environment is present?

2 - How do I actually change this 'headless' mode of java to false?

The version of java installed is below :
Code:
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
Any advice is welcome, thankyou.
 
Old 01-05-2009, 09:38 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,316

Rep: Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878
Quote:
Originally Posted by akuma_linux View Post
Hello

I have an Ubuntu 8.04 machine running tomcat 5.5, and a java application which is showing an error :

Code:
An error occurred:

      java.awt.HeadlessException
This error only occurs on one page of the java app, the rest works fine.

Any advice is welcome, thankyou.
Well, I'm not a big Java guru, but it seems to me that if you're only getting an error on ONE PAGE of your app, there's a problem with the code for that one page, not with Java/Tomcat in general. If there was a problem there, things would go wrong with other pages too....

Have you checked the Tomcat logs?
 
Old 01-05-2009, 09:58 AM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Quote:
Originally Posted by akuma_linux View Post
Hello

I have an Ubuntu 8.04 machine running tomcat 5.5, and a java application which is showing an error :

Code:
An error occurred:

      java.awt.HeadlessException
This error only occurs on one page of the java app, the rest works fine.

Gnome / Xserver is installed and the DISPLAY variable is set to localhost:0.

My Questions are as follows -

1 - With this error, does it mean java is running in headless mode? If so, should headless mode not be set to false since a full graphical desktop environment is present?

2 - How do I actually change this 'headless' mode of java to false?

The version of java installed is below :
Code:
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
Any advice is welcome, thankyou.
That exception is thrown when you make a call to some device (keyboard, mouse, display etc) in a place where those are not available. This code will crash:

Code:
import javax.swing.JOptionPane;

public class MainClass {

	public static void main(String[] args) {
		System.setProperty("java.awt.headless", "true");
		JOptionPane.showMessageDialog(null, "Testing");
	}
}
1 - With this error, does it mean java is running in headless mode? If so, should headless mode not be set to false since a full graphical desktop environment is present?

Nope. If you are manually setting your code to headless, as I did above, it will crash. You could make a check to see if the environment is Headless before setting the properties

2 - How do I actually change this 'headless' mode of java to false?
Check my suggestion above.

Since you said you only get that exception in one part of the program, check what it is doing at that moment. Time to set some breakpoints maybe?

Off-topic note: I love to play with Akuma. Don't particularly like playing against him though

Last edited by Mega Man X; 01-05-2009 at 09:59 AM.
 
Old 01-06-2009, 11:27 AM   #4
akuma_linux
Member
 
Registered: Aug 2006
Distribution: Ubuntu, CentOS
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks for the replies.

I await a reply from the author of the Java app (my role in this was to set up the server to host this app, my knowledge of java coding is poor).

I'll post back if we get it working.

Off-topic note :Good taste Mega Man X, can't wait for sf4!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to find the JARs for javax.swing.* and java.awt.* jlinkels Programming 5 01-02-2009 08:46 PM
java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit artemis8543 Linux - Newbie 4 05-16-2006 09:38 PM
downloading java AWT package zeppelin147 Linux - Software 1 11-17-2005 06:53 PM
Java AWT not working naveenhifi Programming 1 02-26-2004 11:35 PM
fluxbox java awt no title bar Kman Linux - Software 0 06-18-2003 11:47 AM


All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration