MATLAB Answers

Why can't I install MATLAB with the root account in Linux when the installer works for my user account?

335 ビュー (過去 30 日間)
When I try to run the install script as root on Linux I get an error mentioning X11. I can start the installer normally on my user account.


MathWorks Support Team
MathWorks Support Team 2016 年 10 月 31 日
This error is related to some of the environment variables from your user account not being passed to root when running the installer. There are 2 specific variables that will cause this, your DISPLAY variable, which will tell the install what screen to start on and XAUTHORITY which gives user permissions to display programs to that screen. If you are unable to set these variables, please speak to your IT department for assistance.
The DISPLAY environment variable tells program what display they should be started on. You will receive an error such as the below:
Error: Installation cannot proceed. You may either:
1. Set an X11 display, and restart the install process
2. Use the silent install feature by specifying the -mode silent option
Exception in thread "main" Guice provision errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at com.mathworks.instutil.wizard.JEditorPaneHyperlinkHandler.<init>(
while locating com.mathworks.instutil.wizard.JEditorPaneHyperlinkHandler
while locating com.mathworks.instutil.wizard.HyperlinkHandler
for parameter 5 at com.mathworks.wizard.ui.components.SwingComponentFactoryImpl.<init>(
To resolve this, you can temporarily set the DISPLAY variable for root to the value that is set for your user account.
Run the below as your user account:
printenv | grep DISPLAY
This will show your display environment variable. Remember this for later. Now enter the below:
export <DISPLAY>
Where <DISPLAY> is the value of the DISPLAY variable from the printenv command.
On some distributions, other users are prevented from starting windows on X servers owned by other users. The XAUTHORITY environment variable points to the location of a key on your system that is required to start X applications on that display. Depending on your distribution, this key will be located in different locations. An error relating to XAUTHORITY will appear like:
No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':2' as the value of the DISPLAY variable.
The simplest way to get around this is to allow all users on this machine to start programs on this display:
xhost + localhost
If you are connecting to this machine remotely, run the below instead:
xhost +
This will also allow remote users to start programs on this display. After installing MATLAB, you may want to replace these restrictions with either: 
xhost - localhost
xhost -

  2 件のコメント

Weiliang Zhou
Weiliang Zhou 2018 年 4 月 30 日
It shows nothing when I use
printenv | grep DISPLAY
What should I do then? Thanks a lot!
Gergely 2018 年 12 月 5 日
set up a display variable like:

サインイン to comment.

その他の回答 (4 件)

José Carlos Ferreira
José Carlos Ferreira 2016 年 12 月 18 日
編集済み: David 2017 年 1 月 17 日
export <DISPLAY>
command, returns a natural error if the previous command show us that DISPLAY=:0 and we replace <DISPLAY> by "0" (without quotes).
export 0
This naturally ends up in the following error:
bash: export: `0': not a valid identifier

  3 件のコメント

Connor Kurtz
Connor Kurtz 2019 年 2 月 6 日
My issue is after I export DISPLAY=:0, when I try to xhost +, I get xhost: unable to open display ":0"
Kyle Perry
Kyle Perry 2019 年 2 月 14 日
Hello Connor,
If you are still unable to start MATLAB, please contact our support team so we can assist.

サインイン to comment.

Tech Support
Tech Support 2018 年 5 月 2 日
If you are still experiencing this issue, please contact MathWorks support:

  0 件のコメント

サインイン to comment.

Gerhard Giefing
Gerhard Giefing 2019 年 5 月 29 日
I've only SSH access.... there is no Display var in any User or the root... any ideas... only need this server as computing machine... no GUI needed ... have only TUI

  1 件のコメント

Colin Fraser
Colin Fraser 2019 年 6 月 5 日
If you are still experiencing this issue, please contact MathWorks support:

サインイン to comment.

Gerhard Giefing
Gerhard Giefing 2019 年 5 月 29 日
and it its not installing and gives no error

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。




Translated by