When I run MATLAB install script in Ubuntu, I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component
longer output is available here
I know that it's a Java problem and could potentially be fixed by changing the classpath or something like that but I don't exactly know how.
Any Ideas?
For me this error was fixed when I installed the JRE on my system:
apt-get install default-jre
on Ubuntu 12.04, instead of having MATLAB use its own.
I've been battling this problem for the whole evening as well but I stumbled onto a solution that works for me at least.
After trying to install using the silent installer I got a different error with a bit more information. It turned out that a library was missing (libXtst.so.6). I was able to install that on my Ubuntu system with:
apt-get install libxtst6
After that I tried running the GUI installer (over X forwarding) and it looks like it's going to work now.
For MATLAB R2012a Student Edition, in Ubuntu 14.04, I had to install these prerequisites first:
sudo apt-get install default-jre libxtst6:i386 libXext6:i386 libxi6:i386 libncurses5:i386 libxt6:i386 libxpm4:i386 libxmu6:i386 libxp6:i386
Next I installed/activated per MATLAB's instructions (sudo ./install). I answered "yes" when the installer asked to add a symbolic link in /usr/local/bin/
Finally, when launching MATLAB, I have to specify that it run in 32-bit mode:
matlab -glnx86
I assembled those steps from this answer: https://askubuntu.com/questions/363878/how-to-install-32-bit-matlab-in-ubuntu-64-bit
and the Ubuntu MATLAB guide:
https://help.ubuntu.com/community/MATLAB
Optional
I didn't want to type the -glnx86 option each time I launch MATLAB, so I replaced the matlab symbolic link in /usr/local/bin/ with a script that automatically specifies the -glnx86 option:
ls -l /usr/local/bin/matlab #note the destination of the symbolic link
sudo mv /usr/local/bin/matlab /usr/local/bin/matlab.bak
#ensure the first path below matches your symbolic link's destination
echo '/usr/local/MATLAB/R2012a_Student/bin/matlab -glnx86 "$#"' | sudo tee /usr/local/bin/matlab
sudo chmod +x /usr/local/bin/matlab
With that, I can type 'matlab' and it launches properly. (The "$#" in the script forwards all input arguments to matlab.) There's probably a more elegant way to accomplish this, but it worked.
I also encountered a "/lib/libc.so.6: not found" error on matlab startup, which I fixed by following this answer.
Installing gnome (sudo apt-get install gnome) fixed this problem for me. I'm sure this was total overkill, but the required libraries are now available.
Related
My problem is with X11 variable - when Im trying to launch gdx-setup.jar i get output:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
at java.desktop/java.awt.Window.<init>(Window.java:553)
at java.desktop/java.awt.Frame.<init>(Frame.java:428)
at java.desktop/java.awt.Frame.<init>(Frame.java:393)
at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
at com.badlogic.gdx.setup.GdxSetupUI.<init>(GdxSetupUI.java:101)
at com.badlogic.gdx.setup.GdxSetup.main(GdxSetup.java:620)
Im running ubuntu on my local laptop (NO SSH).
System details
I've tried commands:
sudo apt-get update --fix-missing
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo dpkg reconfigure -a
sudo apt install -f
It didnt help at all...
When Im running AWT from intellij I can see GUI normally and there's no exception.
Ive followed there instructions while installing libgdx:https://tutorialforlinux.com/2022/11/14/step-by-step-libgdx-ubuntu-22-04-installation-guide/2/
echo $DISPLAY
output:0
Installed: xorg-x11
Double clicking on jar causes with no response... Ive marked jar as executable
You can specify one of many installed java versions when running from intellij. When running from the command line its just a single one.I think your default java probably -actually truly is- headless. Follow this guide here to change your default command line java. I mean the error is specifically that if fails the headless check.
Follow here to switch the default cmd line java version.
https://computingforgeeks.com/how-to-set-default-java-version-on-ubuntu-debian/
Its not unusual to have headless because thats all server side stuff needs.
This question already has answers here:
Java command not found on Linux
(6 answers)
Closed 6 years ago.
i try to run spark application on a cluster standalone mode, when i access to some remote machines and use "java -version" command i get the information(java version ..), but on others i get an error
-bash: command not found
so i thought that maybe java is not installed on those nodes so i tried with:
sudo apt -get install openjdk-8-jdk
but i get the same error, so wanna know how can i fix this, and i have some questions:
-Is it necessary that i install java on all remote machines? or if i install it only on the master node it is enough?
-if i have to install it on each node, how can i fix the problem that i explained before? (can not use install command...)
-In my code, i used expressions that are only supported with jdk 8, but some nodes (in which i could get "java version") it is installed jdk7, so do i have to reinstall jdk8 ?
"command not found" error means that particular command you're trying to invoke is not found in neither of directories listed in $PATH system variable.
There are two ways how to fix this:
1) Specify full path when running an executable:
/opt/jdk-12345/bin/java -version
2) add the very same path to the beginning of PATH (change will be applied to current session only):
export PATH=/opt/jdk-12345/bin:$PATH
java -version
To fix this permanently, add that line (export PATH=/opt/jdk-12345/bin:$PATH) to ~/.bashrc (if BASH is default shell for that user) or to ~/.profile
Also because this is Unix Java, make sure to set up LD_LIBRARY_PATH and CLASSPATH variables if you're running some server applications. Usually this is done in application startup scripts, no need to go global.
Please verify which Server OS you're running ( uname -a or /bin/uname -a ) because different Unix systems have different package managers: apt-get is for Ubuntu/Debian, rpm for RedHat, Entropy for Sabayon/Gentoo, etc...
I need to uninstall Java jdk1.6.0.27 from RHEL 5.7 and then install another version jre-7u40-linux-x64.rpm.
The firs thing I did was to find out the current java version installed using the
java -version command and the output is "java version "1.6.0_27"".
After that I tried to check the previews version of java with the command:
rpm -qi jdk
The output is "package jdk is not installed"
After installing the package jre-7u40-linux-x64.rpm in the /usr/java directory there are two java packages.
The output of the ls command on /usr/java is:
default jdk1.6.0_27 jre1.7.0_40 jre-7u40-linux-x64.rpm latest.
when I run the command "alternatives --config java" the output is:
*+ 1 /usr/java/latest/bin/java
I am new to RHEL and I need some help to understand the situation.
To conclude I need some help to remove the previews jdk1.6.0.27 and to install jre1.7.0_40.
Thank you in advance for your help!
Best regards,
Claudio
First, find out your real java executable. Start with
which java
This is going to give you some response such as:
/usr/bin/java
Next, do
ls -l /usr/bin/java
(Or whatever it returned).
It will probably write something like:
/usr/bin/java -> /etc/alternatives/java
Do the same for whatever is pointed to by the arrow, until finally, when you do ls -l on it, there is no arrow.
Then, for that particular file, find out which rpm provides it by using
rpm -q -f <full path of the file you found>
It should tell you which package it belongs to, and then you can uninstall that.
However, if the rpm command returns The file ... is not owned by..., then your Java has not been installed using an rpm. It may have been installed manually by someone in the past.
This makes uninstalling it a lot more problematic.
If you haven't found your answer:
leave old java where it is, don't even bother with it
install new version with: rpm -ivh /root/jdk-7u40-linux-x64.rpm
deactivate old java
export new version
Deactivating old java (note entering hashtags before every line, manual installation required editing of profile, so edit it one more):
vi /etc/profile
#JAVA_HOME=/usr/java/jdk1.6.0_27
#export JAVA_HOME
#PATH=$JAVA_HOME/bin:$PATH
#export PATH
Exporting nev version (note adding new lines in profile followed after old entries):
export JAVA_HOME=/usr/java/latest
export JRE_HOME=$JAVA_HOME/jre
export J2RE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$J2RE_HOME/bin:$PATH
Check nev version with standard command for checking of installed sw.
Hope this suits your needs.
Just wondering: you're trying to prepare BFBOX for acceptance? Just courious! If you want more info please send me an email, ok?
I have Oracle SQL Developer installed at the following location:
/opt/sqldeveloper
Every time I run it using the command ./sqldeveloper, I get the following error from the GUI:
You are attempting to run with Java 1.6.0_31. Running this product is
supported with a minimum Java version of 1.7.0_51 and less than 1.8
I updated the sqldeveloper.conf file with the following paths:
/usr/java/jdk1.8.0_05
and
/usr/java/jdk1.7.0_55
And despite all that, same error again.
I know I am a bit late with the response, but I had exactly the same issue until this morning.
What I did is changed:
~/.sqldeveloper/4.0.0/product.conf
FYI:
How I figure it out:
1. Go to OracleSQLDeveloper -> Help(menu) -> Properties
2. Find 'java.home'
(For some reason it was pointing to /usr/lib/jdk1.7.0 (ver 1.7.45), even I've changed sqldeveloper.conf)
3. Since I didn't recognized that specific version, I just ran:
sudo "find / .... -name '*.conf' -exec grep 'jdk1.7.0' ..."
goodluck
Configure Path to Java
SQL-Developer needs to know how to find your Java Developer Kit:
Note: You need to specify /usr/lib/jvm/java-6-openjdk-i386 on 32-bit OS installations.
Terminal
cd $HOME
mkdir -p .sqldeveloper
cd $HOME/.sqldeveloper
echo "/usr/lib/jvm/java-6-openjdk" > jdk
I'm trying to run a .jar file on my centos box, but it says "java: command not found".
What's the best or easiest way to solve this? I was hoping for a yum command but not sure that that will exist for java?
Apparently some versions of CentOS doesn't come with a JVM installed due to some licensing restriction. See HowTo Install Java on CentOS 4 and CentOS 5 for instructions.
You can use such command to check if Java is available in your repository:
yum list | grep java
It should return something like that:
java-1.6.0-openjdk
java-1.6.0-sun
If such package exists you can install it using such command (run it as the root user):
yum install java-1.6.0-openjdk
Either the JRE is not installed or, more likely, its location is not included in your PATH environment variable. If the java executable is not in your PATH, you would need to use the full path & filename to execute it.
cd to the location of the jar file
C:\temp>java -jar sample.jar