Could not initialize class sun.awt.X11GraphicsEnvironment

If none of the more specific forums is the right place to ask

Could not initialize class sun.awt.X11GraphicsEnvironment

Postby reis3k » 2009-04-06 14:04

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
reis3k
 
Posts: 11
Joined: 2009-03-04 09:27

Postby bugsbunny » 2009-04-06 14:28

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.
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Postby reis3k » 2009-04-06 15:01

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?
reis3k
 
Posts: 11
Joined: 2009-03-04 09:27

Postby bugsbunny » 2009-04-06 15:18

# gdmsetup
Security tab
Just mark the appropriate box.
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Postby reis3k » 2009-04-06 15:30

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
reis3k
 
Posts: 11
Joined: 2009-03-04 09:27

Postby bugsbunny » 2009-04-06 15:45

You need to run that from an x-term, possibly using gksu. It's found in the gnome menus under Administration|Login Window
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Postby reis3k » 2009-04-06 16:09

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

Postby reis3k » 2009-04-07 14:45

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?
reis3k
 
Posts: 11
Joined: 2009-03-04 09:27


Return to General Questions

Who is online

Users browsing this forum: No registered users and 28 guests

fashionable