Borroot
Posts: 2
Joined: Sat Feb 10, 2018 11:27 am

JavaFX: Cannot open display and create resource

Sat Feb 10, 2018 11:56 am

I am currently using a Raspberry Pi 3 (with the latest version of NOOBS) to run a JavaFX application. I installed all the necessary libraries for JavaFX.

However when I run my applications using:

Code: Select all

sudo java -jar (fileName)

I get the following errors:

Code: Select all

Cannot open display
Cannot create resource
I followed this: viewtopic.php?t=200597 tutorial, but the problem is not solved yet.

The application runs fine but you can not interact with it. Everything except the application turns black (while running) and when you try to select something in the application it acts as if it is transparent. It is possible however to use the keyboard as an interacting medium (not the mouse).

Since the pictures I made are to big, here is a link to them: https://1drv.ms/f/s!AqsVBsq_-Nr0gcRxYVaKidg4nL5zSA.

Thanks for your help in advance!

User avatar
DougieLawson
Posts: 31219
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: JavaFX: Cannot open display and create resource

Sat Feb 10, 2018 9:02 pm

Use gksudo
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Borroot
Posts: 2
Joined: Sat Feb 10, 2018 11:27 am

Re: JavaFX: Cannot open display and create resource

Mon Feb 12, 2018 11:30 am

DougieLawson wrote:
Sat Feb 10, 2018 9:02 pm
Use gksudo
I tried running the program with gksudo, but the cursor still disappears when the program is started. I ran the commands as follows:

Code: Select all

gksudo -u pi

Then a small window appears where I typed in:

Code: Select all

java -jar Connect4.jar

The program then starts, but the cursor still disappears. I might want to note that I can not exit the program either since everything turns black (except the program started -> Connect4.jar) and the cursor is not visible.

Return to “Java”

Who is online

Users browsing this forum: No registered users and 5 guests