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: 32374
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

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

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.

jimd999
Posts: 1
Joined: Mon Mar 26, 2018 8:58 pm

Re: JavaFX: Cannot open display and create resource

Mon Mar 26, 2018 9:01 pm

I am having the exact same problem. JavaFX display comes up, all the rest of the screen is black (which is kinda ok, as I want my app to take the whole screen) no mouse.

I have tried everything to no avail - the no input is a killer.
I updated 99-com.rules so it does have permission. (I no longer get the Udev: Failed to write to /sys/class/input/mice/uevent " etc.
I am using the Gluon JavaFX.

Return to “Java”

Who is online

Users browsing this forum: No registered users and 2 guests