Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Could not initialize class sun.awt.X11GraphicsEnvironment

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
reis3k
Posts: 11
Joined: 2009-03-04 09:27

Could not initialize class sun.awt.X11GraphicsEnvironment

#1 Post by reis3k »

Hi,
I have to install a jar file to /usr/local/. But when I run the command :
java -jar installme.jar
It gives an error about display:
No protocol specified
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
...
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
...

However, when I login as a normal user instead of root, it allows me to start graphical installation. But, the setup needs to copy some files to /usr/local folder for which root's privileges is needed.

I've tried to write to .bashrc and profile this:
DISPLAY='0.0'
export DISPLAY
but it didn't work. What can I do? Thanks

User avatar
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

#2 Post by bugsbunny »

Double check the permissions on /usr/local. I don't think I changed mine and mine are:
Owner = root = rwx
Group = staff = rwx
Other = rx

In which case just make your user a member of the staff group, then log-out and back in.

reis3k
Posts: 11
Joined: 2009-03-04 09:27

#3 Post by reis3k »

bugsbunny wrote:Double check the permissions on /usr/local. I don't think I changed mine and mine are:
Owner = root = rwx
Group = staff = rwx
Other = rx

In which case just make your user a member of the staff group, then log-out and back in.
I was a member of the staff group, I added it as a primary group to me and relogin to X:
usermode -g staff myname
But I got the same error from jar installer says that could not create a folder inside /usr/local/../..

I've also checked the group privileges for that folder giving write error.

Is there any way to login as a root and run the setup in the terminal with X enabled?

User avatar
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

#4 Post by bugsbunny »

# gdmsetup
Security tab
Just mark the appropriate box.

reis3k
Posts: 11
Joined: 2009-03-04 09:27

#5 Post by reis3k »

bugsbunny wrote:# gdmsetup
Security tab
Just mark the appropriate box.
I got this error after I ran "gdmsetup":
No protocol specified

(gdmsetup:5134): Gtk-WARNING **: cannot open display: :0.0

User avatar
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

#6 Post by bugsbunny »

You need to run that from an x-term, possibly using gksu. It's found in the gnome menus under Administration|Login Window

reis3k
Posts: 11
Joined: 2009-03-04 09:27

#7 Post by reis3k »

bugsbunny wrote:You need to run that from an x-term, possibly using gksu. It's found in the gnome menus under Administration|Login Window
It was the first time that I heard gksu as a newbie. I run the gksu as my user privileges (cos got the same display error when I was root), then enabled the "preserve environment" property from "advance" menu of gksu (cos it didn't recognize the "java -jar myfile.jar"). Then it worked flawlessly!

But I didn't figure out to what to do with gnome menus under Administration|Login. It seems that there is nothing related to gksu or gdmsetup.

Thank you very much for your help.

Kind regards,

reis3k
Posts: 11
Joined: 2009-03-04 09:27

#8 Post by reis3k »

Hi again,
I've just got something and wanted to share with you:
When log in as a root with this way (su -) I got the previous errors mentioned before, but when I use just (su) all the problems encountered with display is solved.

I know that putting a dash after su enables root environments (e.g JRE), but why I can get display error with every app needs X?

Post Reply