Dual Monitor (two displays)
Hi,
I work on a dual monitor setup with two X servers running. Does anybody
have an idea how I can start the applications on the second screen?
It would help to prepend a "DISPLAY=:0.1" before the java command that
launches the application - but how could I achieve this?
Any ideas?
Johannes Schneider
请先登录再写评论。
Johannes Schneider wrote:
That's not a setup I've used (I switch between multiple desktops that
each span two screens), but...
...if that's sufficient then this should work:
1. rename the java executable in the JDK/JRE that's used to launch your
application to, say, java-real
2. create an executable shell script named java (in the same JDK/JRE bin
directory) containing (minimally):
#!/bin/sh
DISPLAY=:0.1 $(dirname $)/java-real "$@"
(This relies on the fact that IDEA uses the full path to java when it
constructs the commandline.)
You could make the replacement script as fancy as you like in terms of
how it determines the display you want to use etc..
HTH,
--
Mark Scott
mark@codebrewer.com
Hi,
thanks for your answer.
Of course this is a workaround. But I don't want to "break" my JRE if I
can avoid it.
So I would prefer a setting/hack within idea (some properties file
around?) where the run command may be changed...
Johannes Schneider
Mark Scott wrote:
>> I work on a dual monitor setup with two X servers running. Does anybody
>> have an idea how I can start the applications on the second screen?
>> It would help to prepend a "DISPLAY=:0.1" before the java command that
>> launches the application - but how could I achieve this?
Johannes Schneider wrote:
Why don't you just make a shell script with the following contents?
#!/bin/sh
export DISPLAY=:0.1
exec path/to/application
Kreiger
Attachment(s):
signature.asc
Okay,
but how can I run a shell script within idea?
Johannes Schneider
Christoffer "Kreiger" Hammarström wrote:
>> Hi,
>>
>> thanks for your answer.
>> Of course this is a workaround. But I don't want to "break" my JRE if I
>> can avoid it.
>> So I would prefer a setting/hack within idea (some properties file
>> around?) where the run command may be changed...
>>
>>
You had not mentioned what platform you are on, so it is possible that the above script won't work properly (it depemds on the implementation of /bin/sh). If it doesn't work , try the following:
#!/bin/sh
DISPLAY=0:1
export DISPLAY
exec path/to/application
The thing you need to do is get the environment variable DISPLAY set properly to get Idea to be displayed on your second monitor by your OS. This is not a work around, it's the way things are supposed to work in an X windows environment.
I can start Idea on the second monitor - this is not the problem I have!
I want to run Idea on the first display. And then start an application
(that I have developed and that I try to debug or test) on the other
screen using the Idea run functionality...
Johannes Schneider
Ralph Saunders wrote:
Sorry, I misunderstood. You can always run the application in it's own Java VM and debug it remotely with Idea. The script to run your app would be something like:
DISPLAY=0:1
export DISPLAY
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5055 com.whatever.yourApp
If you want to debug something happening in your startup code, you should change suspend=n to suspend=y, which will tell the VM to wait until a debugger has connected before running the app.
I know this is not as easy as being able to debug the app by running it under Idea, but it will work.
Yes I know.
But as you said, starting the app using Idea is easier...
Thanks
Johannes Schenider
Ralph Saunders wrote: