Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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....
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 08:59 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.