swing not getting initialized when the DISPLAY is not set


 
Thread Tools Search this Thread
Top Forums Programming swing not getting initialized when the DISPLAY is not set
# 1  
Old 07-16-2009
swing not getting initialized when the DISPLAY is not set

I have a batch programme which will load the Spreadsheet into database..

When the DISPLAY is set and X11 window server is running, there is no issue in reading the spreadsheet and loading into database without lauching UI.

But if the display is not set, then there is an issue... Any ideas over this ?? Why does a batch programme requires DISPLAY and X11 window server to be set when there is no need of UI to launch....

Code pasted below :

24 public class Spreadsheet extends com.f1j.swing.JBook
25 {
26 private int failedSheetNum = 0;
27
28 public Spreadsheet()
29 {
30 super();
31 setup();
32 }


Exception is thrown at line 30 :

Exception in thread "main" Logging starts at 15/7/2009 10:52:16
Loading the XML...
This might take a few seconds.Please wait...
Loading the Mapping template...
Loading the input data file...
This might take a few seconds.Please wait...
java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:56)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at java.awt.Toolkit$2.run(Toolkit.java:492)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:485)
at java.awt.SystemColor.updateSystemColors(SystemColor.java:339)
at <Unloaded Method>
at java.awt.Insets.initIDs(Compiled Code)
at com.f1j.swing.JBook.<init>(DashoA8533)
at com.f1j.swing.JBook.<init>(DashoA8533)
at gdm.ssl.Spreadsheet.<init>(Spreadsheet.java:30)
# 2  
Old 07-16-2009
Try to see if headless mode works for you:

Using Headless Mode in the Java SE Platform
# 3  
Old 07-17-2009
headless mode does not work for me.. I tried it using JVM option -Djava.awt.headless=true

Wondering, is there any similar option for swings only? (Formula one has 2 components one is awt and other one is swing)
# 4  
Old 07-20-2009
Error

I need it urgently the solution... Any ideas over this folks?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Can Scanner be Initialized from the Terminal

Hi, somewhat of a newbie with Linux, although I have been at it for about three weeks now. Is there a way to wake up or initialize my scanner with a command in the terminal? (6 Replies)
Discussion started by: klrman
6 Replies

2. Solaris

DISPLAY not set

Hi, When i invoke DBCA as oracle user , i get following usircd01:KAM:/opt/oracle10/product/10.2.0/bin>./dbca DISPLAY not set. Set DISPLAY environment variable, then re-run. usircd01:KAM:/opt/oracle10/product/10.2.0/bin>echo $ORACLE_SID CCE ... (6 Replies)
Discussion started by: Maddy123
6 Replies

3. Windows & DOS: Issues & Discussions

How to automatically set the DISPLAY var?

Hi all, Our users use Putty on Windows servers to log on to UNIX via SSH and run GUI applications. Is there a way to automatically get the display numbers from xming or Exceed (that are running on Windows) to set the DISPLAY var properly on UNIX? X11 forwarding is not an option. The closest I... (3 Replies)
Discussion started by: ejianu
3 Replies

4. Solaris

Where/how is $DISPLAY set when connecting with XDMCP?

My "problem" is that it's set correctly and I want to break it, but can't figure out where it's getting set in the first place. I can see several places where $DISPLAY is referenced but at the point that the dollar sign is in front it's already an environment variable(I think). I thought... (1 Reply)
Discussion started by: gctaylor
1 Replies

5. Solaris

Set display to text

How do I set up my solaris 10 machine to display in text mode instead of graphics mode, permanently? (1 Reply)
Discussion started by: jastanle84
1 Replies

6. UNIX for Dummies Questions & Answers

.zshrc not initialized

Hi, I just updated /etc/passwd so that my default shell is zsh. After I save and make a new connection I can echo $SHELL and see /usr/bin/zsh, but my prompt still looks like bash and some env var that I setup in my local .zshrc file are not set. If I type zsh, then my prompt changes and I have my... (7 Replies)
Discussion started by: yankee428
7 Replies

7. Shell Programming and Scripting

How to check if export DISPLAY is set or not?

Hi All, I use "export DISPLAY=same_host:0.0" to set my export DISPLAY and it is working fine for me.. Problem here is I have developed a script for which i should run export DISPLAY prior to running my script.... so my script should check whether export DISPLAY is set or not.. if... (6 Replies)
Discussion started by: smarty86
6 Replies

8. Solaris

Can't make 'set DISPLAY' to work

Hi, I used exceed and putty in the past to HP server with no problem to make 'set DISPLAY' work on my desktop. However now I have Solaris 9 on Sun server 480 and I only have putty. I can't bring the X window (eg xclock, etc) to my desktop. I tried X11Fowarding, xhost, and so on, it doesn't... (5 Replies)
Discussion started by: jr_zhang
5 Replies

9. UNIX for Dummies Questions & Answers

mandrake 6.0 , display not set despite

hi, i am on mandrake 6.0, shell of root user is bash. okay, i did the below #display=localhost.localdomain:0.0 #export display #xhost +localhost.localdomain system replies xhost added.. i did a set and there was an entry there.. now i want to install oracle, so did a ./runInstaller ... (2 Replies)
Discussion started by: yls177
2 Replies

10. UNIX for Dummies Questions & Answers

set display

Hi All: An elementary Unix Question, How can i set the display number and run a program in that display. If i type the name of the executable the program opens in the console(display number 0), however, i want it to open in another display number. How can i do that. Appreciate the help... (2 Replies)
Discussion started by: preetham
2 Replies
Login or Register to Ask a Question