LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 06-22-2009, 08:42 AM   #1
rockdiablo
Member
 
Registered: Dec 2008
Posts: 30

Rep: Reputation: 15
bash script iterating multiple instances of java GUI on different desktops


Hi,
Does anybody have an Idea of how to launch a simple java GUI app via a bash script which would iterate through (or even more simply just repeat itself 4 times) desktop displays and start the application to be run on each desktop? for example I have a small java clock which i would like to run (seperate instances of) on each of my 4 local displays: 0.0, 0.1, 0.2, 0.3 but I only want to run the script once.

Currently, I'm using the following script called "javaClock":

#!/bin/bash

/usr/java/latest/bin/java -jar "/home/devel/javaProjects/javaClock/dist/javaClock.jar"

and simply dragging it from one desktop to the other I would like for it to open on each desktop, so that I can at it to my boot processes.

Thanks in advance.

Andy
 
Old 06-22-2009, 11:48 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,449

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Code:
#!/bin/bash

for DISPLAY in 0.1 0.2 0.3 0.4 ;
do
  DISPLAY=":$DISPLAY"
  export DISPLAY
  /usr/java/latest/bin/java -jar "/home/devel/javaProjects/javaClock/dist/javaClock.jar" &
done
wait

Last edited by Guttorm; 06-22-2009 at 11:50 AM. Reason: forgot DISPLAY wants a :0.1 etc...
 
Old 06-23-2009, 07:35 AM   #3
rockdiablo
Member
 
Registered: Dec 2008
Posts: 30

Original Poster
Rep: Reputation: 15
Thanks!
The script seems to work. Now I'm getting a java Error:

java.lang.InternalError: Can't connect to X11 window server using '0.0' as the value of the DISPLAY Variable.
java.lang.InternalError: Can't connect to X11 window server using '0.1' as the value of the DISPLAY Variable.
java.lang.InternalError: Can't connect to X11 window server using '0.2' as the value of the DISPLAY Variable.
java.lang.InternalError: Can't connect to X11 window server using '0.3' as the value of the DISPLAY Variable.
(cant copy and paste cause its a different machine)

I know that this has become a java problem and isn't really appropriate for this thread, but anybody that comes across this that has an idea - suggestions would be much appreciated.

Maybe its a X server configuration problem? I get the same error when I manually set the DISPLAY variable to 0.1 or localhost:0.1 using:

$ export DISPLAY=:0.1
$ javaClock
java.lang.InternalError: Can't connect to X11 window server using '0.1' as the value of the DISPLAY Variable.


-- again that's the jist of it- cant copy and paste.

Same thing when I set it back to 0.0. so I'm obviously doing something wrong.


Thanks
 
  


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
[SOLVED] Preventing multiple instances of a shell script from running concurrently Dave Lerner Programming 17 04-21-2020 12:53 PM
Makign a GUI for a Bash script aaargh486 Programming 10 05-11-2010 09:20 AM
kickstart; how-to info needed for multiple instances of RH OS's and multiple unique v Joe_Wulf Linux - Server 4 06-21-2007 11:18 PM
Bash script - how to tell if in GUI or CLI? dive Programming 2 11-19-2005 02:12 AM
Preventing multiple instances of MPlayer (GUI) MrPotato Linux - Software 1 08-22-2005 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:03 PM.

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
Open Source Consulting | Domain Registration