Java는 DISPLAY 변수의 값으로 'localhost : 10.0'을 사용하여 X11 윈도우 서버에 연결할 수 없습니다.
localhost의 포트 10.0에 X11을 표시하기 위해 Java를 사용하는 스크립트가 있습니다.
하지만 항상이 오류가 발생합니다
java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:62)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:178)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:142)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at java.awt.Toolkit$2.run(Toolkit.java:849)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
at ij.io.Opener.openJpegOrGif(Opener.java:367)
at ij.io.Opener.openImage(Opener.java:220)
at ij.io.Opener.openImage(Opener.java:249)
at ij.io.Opener.open(Opener.java:116)
at ij.IJ.open(IJ.java:1112)
at ij.macro.Functions.open(Functions.java:2006)
at ij.macro.Functions.doFunction(Functions.java:129)
at ij.macro.Interpreter.doStatement(Interpreter.java:205)
at ij.macro.Interpreter.doBlock(Interpreter.java:515)
at ij.macro.Interpreter.runUserFunction(Interpreter.java:278)
at ij.macro.Interpreter.getFactor(Interpreter.java:1200)
at ij.macro.Interpreter.getTerm(Interpreter.java:1162)
at ij.macro.Interpreter.getExpression(Interpreter.java:1145)
at ij.macro.Interpreter.getBooleanExpression(Interpreter.java:881)
at ij.macro.Interpreter.getLogicalExpression(Interpreter.java:857)
at ij.macro.Interpreter.getBoolean(Interpreter.java:850)
at ij.macro.Interpreter.doIf(Interpreter.java:829)
at ij.macro.Interpreter.doStatement(Interpreter.java:217)
at ij.macro.Interpreter.doBlock(Interpreter.java:515)
at ij.macro.Interpreter.doStatement(Interpreter.java:241)
at ij.macro.Interpreter.doIf(Interpreter.java:831)
at ij.macro.Interpreter.doStatement(Interpreter.java:217)
at ij.macro.Interpreter.doStatements(Interpreter.java:195)
at ij.macro.Interpreter.run(Interpreter.java:99)
at ij.macro.Interpreter.run(Interpreter.java:65)
at ij.macro.Interpreter.run(Interpreter.java:75)
at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:127)
at ij.plugin.Macro_Runner.runMacroFile(Macro_Runner.java:112)
at ij.IJ.runMacroFile(IJ.java:103)
at ij.ImageJ.main(ImageJ.java:517)
이 문제를 해결하기 위해 모든 것을 시도했습니다.
export DISPLAY=:10.0
export DISPLAY=localhost:10.0
포트 0.0도 시도했지만 항상 동일한 오류가 발생합니다.
xhost를 시도한 후
xhost +local:all
xhost: unable to open display ""
xhost: unable to open display ":10.0"
이 문제를 어떻게 해결할 수 있습니까? X 서버가 실행되지 않는다고 생각했기 때문에 startx
해당 포트에서 실행 중이라고 말했습니다.
내 시스템은 Ubuntu 서버 에디션 10.04입니다.
이 명령은 문제를 해결하는 데 도움이되었습니다.
export DISPLAY=:0
-Djava.awt.headless=true
시작시 매개 변수 를 지정해야합니다 .
DISPLAY 변수 제거
unset DISPLAY
이는 대부분의 경우 (예 : 응용 프로그램 서버 또는 기타 Java 기반 도구 시작)에 도움이되며 많은 명령 줄을 수정하는 것을 방지합니다.
It can also be comfortable to add it to the .bash_profile for a dedicated app-server/tools user.
I think you are working in sudo mode.Please checkout to the user mode and try again
In case anybody trying to run the automated unit tests via maven-surefire-plugin on CI(jenkins,..), and getting the above mentioned error, be sure to update your surefire plugin configuration :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
</plugin>
This will fix it:
/usr/bin/java -Djava.awt.headless=true $Your_program
After several days of futile effort of installing glassfish on raspberry pi 2 with headless fedora 22, Below worked for me without a hitch
unset DISPLAY
java -Djava.awt.headless=true -jar glassfissh-installer-v2ur2-b04-linux.jar
got my help from here
For me logging in as -Y instead of -X worked.
In case you've got untrusted X11 as shown below, then try -Y flag instead (if you trust the host):
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
First: start XQuartz
Second: ssh -X user@ip_address
...: start your process
if you ssh and then start XQuartz you will get that error
First do this either in Build Phase of Jenkins if using or set in /etc/profile:
unset DISPLAY
export DISPLAY=:0
then set this property either in java code or using maven: -Djava.awt.headless=false
Solved. I just logout and login with xorg!
Michael-O gave useful approach to solve the problem. Another way to solve this is by starting the server with Putty Console.
In my case there was no space left in my machine and I faced the same issue. Some times it could be the space issue. Check the space in your Linux/Unix environment and make sure your machine have enough space.
I was using Xming and got similar error. Following steps were taken to fix the issue:
- In Xming launch check the box no access control.
- In putty ran the following command:
DISPLAY=XXX.XXX.XXX.XX:0.0; export DISPLAY
Replace XXX.XXX.XXX.XX
with your IP address.
the only way i got it to work was running the script with a template. e.g. sudo ./glassfish-3.1.2.2-unix.sh -s template
This installs Glassfish in Silent Mode. http://docs.oracle.com/cd/E18930_01/html/821-2427/ghmva.html
I run into the same error with you when i run the jconsole command at remote. I want to modify a parameter at jconsole that run on a remote Linux host, i can login the host use the secureCRT, the terminal throw this error information. Fortunately, when use the Putty, it's ok. Weird....
If you see this error in Hudson, try to remove the .java directory from your home directory, it may work for you.
If you start application on a remote server while logged in by ssh then another way would be to start ssh with -x
parameter or add ForwardX11 no
in your /etc/ssh/ssh_config
. In this case ssh will not create environment variable DISPLAY.
If you're triggering your code from Jenkins, enabling the option "Start Xvfb before the build, and shut it down after" might help. It helped me.
change to a another user and try except root. it works for me.
I just didn't log out of root before running ./studio.sh All set.
For Ubuntu 17.10 Install X virtual frame buffer (xvfb)
apt install xvfb
And added these lines to the /etc/profile file...
# Start the X virtual frame buffer (Xvfb)
if [ -f /usr/X11R6/bin/Xvfb ]; then
/usr/X11R6/bin/Xvfb :1 -screen 0 1366x768x32
fi
# Set the DISPLAY variable for the X virtual frame buffer (Xvfb)
export DISPLAY=localhost:1.0
In my case this error was not related to the DISPLAY port. I was trying to load an XML into Windchill (a PLM-software) and received only the above error on the terminal. In a logfile I found the report that my XML-file was corrupt. Maybe someone has a similar problem and can use this answer.
For me, the problem was that xorg-x11-xauth wasn't installed. I installed it and then it worked.
The packages that I have now are:
- libX11-common-1.6.3-2.el6.noarch
- libX11-1.6.3-2.el6.i686
- libX11-1.6.3-2.el6.x86_64
- xorg-x11-drv-ati-firware-7.6.1-2.el6.noarch
- xorg-x11-xauth-1.0.9-1.el6.x86_64
'programing' 카테고리의 다른 글
소금이 사전 공격을 '불가능'하게 만드는 이유는 무엇입니까? (0) | 2020.09.16 |
---|---|
iPad의 호스트 파일을 편집 할 수 있습니까? (0) | 2020.09.16 |
.gitignore NuGet 제외 패키지 / 포함 패키지 /repositories.config (0) | 2020.09.16 |
PassportJS를 사용하여 추가 양식 필드를 로컬 인증 전략에 어떻게 전달합니까? (0) | 2020.09.16 |
한 프로젝트에서 Bitbucket과 GitHub를 동시에 사용하는 방법은 무엇입니까? (0) | 2020.09.16 |