I was running a geoscript-groovy tutorial code:
groovy:000> import geoscript.layer.GeoTIFF
groovy:000> format = new GeoTIFF()
groovy:000> raster = format.read(new File("raster.tif"))
, and got the follow errors:
ERROR java.lang.NoClassDefFoundError:
javax/media/jai/ImageLayout
I have limited knowledge about JAI. I don't know whether this is a general JDK configuration issue or an issue with groovy etc.
My questions are:
What's the cause of this error associated with javax.media.jai.ImageLayout and how to fix it?
How do I verify if javax.media.jai.ImageLayout is really installed.
Thanks
P.S. The software environment is Ubuntu 12.04 with:
$java -version
java version "1.6.0_32"
OpenJDK Runtime Environment (IcedTea6 1.13.4) (6b32-1.13.4-4ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
$groovy -v
Groovy Version: 1.8.6 JVM: 1.6.0_32 Vendor: Sun Microsystems Inc. OS: Linux
-- UPDATE --
I changed JDK to oracle
$ java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
and still I am getting the following error:
ERROR java.lang.NoClassDefFoundError:
javax/media/jai/ImageLayout
at org.geotools.gce.geotiff.GeoTiffFormat.getReader (GeoTiffFormat.java:287)
at org.geotools.gce.geotiff.GeoTiffFormat$getReader.call (Unknown Source)
Also, the commands I used to install Oracle JDK are:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
I also did
sudo apt-get install libjai-core-java libjai-imageio-core-java
and I am still getting the same error.
To use javax.media.jai.ImageLayout you need an Oracle JDK. It's not present in OpenJDK. I don't know the library you're using so I can't tell you if there is any option to e.g. inject different strategy for image manipulation. Switch to Oracle JDK and test if it works for you that way.
Related
I had openjdk 11.0.2 installed. I upgraded the java version by running
sudo apt update
sudo apt install openjdk-11-jdk
If I run sudo apt install openjdk-11-jdk again, it shows a message saying that "openjdk-11-jdk is already the newest version (11.0.11+9-0ubuntu2~20.04)"
However, when I do java -version it displays the older version 11.0.2 not 11.0.11
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
The JAVA_HOME still shows "/opt/java/jdk-11.0.2", so I guess this might be the problem that the java -version is still showing the older version?
When I do whereis java it shows
java: /usr/bin/java /usr/share/java /opt/java/jdk-11.0.2/bin/java /mnt/c/Program Files/Common Files/Oracle/Java/javapath_target_917640/java.exe /usr/share/man/man1/java.1.gz
Not sure where the newest version was installed so that I can make the JAVA_HOME point to that one
openjdk-11-jdk-headless_11.0.11+9-0ubuntu2~20.04_amd64.deb and openjdk-11-jre-headless_11.0.11+9-0ubuntu2~20.04_amd64.deb package shows (by extracting with 7-zip) that OpenJDK 11 will be installed at /usr/lib/jvm/java-11-openjdk-amd64.
This will give you enough information about appending environment variables such as PATH and JAVA_PATH.
And, there may be a path called default-jvm or so, you may use that path accordingly.
So it seems that I have Java installed after running the below line in the SageMaker Notebook Terminal:
bash-4.2$ sudo yum install java-1.8.0-openjdk
In the terminal I write the following to confirm:
bash-4.2$ java -version
java version "1.7.0_261" OpenJDK Runtime Environment (amzn-2.6.22.1.83.amzn1-x86_64 u261-b02) OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
In my notebook I have the following Lines of code:
import tabula
tabula.environment_info()
The notebook results in an error with:
java -version` faild. `java` command is not found from this Pythonprocess. Please ensure Java is installed and PATH is set for `java`
Yet, in the terminal I see this:
bash-4.2$ java -version
java version "1.7.0_261" OpenJDK Runtime Environment (amzn-2.6.22.1.83.amzn1-x86_64 u261-b02) OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
I definitely have a java environment. How can I set my notebook to find this?
One approach is to install it from sagemaker notebook via !sudo yum install ...
You can verify the path in the notebook to confirm the linking
I am running Ubuntu 16 on my computer and
I am attempting to run a Java application on my computer and I get the following error:
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 11.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
However I have already Java installed and a virtual machine.
When I press
$java -version
I get the following output:
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (Zulu 8.33.0.1-linux64) (build 1.8.0_192-b01)
OpenJDK 64-Bit Server VM (Zulu 8.33.0.1-linux64) (build 25.192-b01, mixed mode)
Does anyone know how I can fix this problem? Many thanks.
Compare
The version of the JVM must be at least 11
and
openjdk version "1.8.0_192"
(i.e. Java 8)
Upgrade your Java version.
From the output above, it is evident that an updated version of Java is missing. You need at least a version of JVM equal to 11 or upper.
Let’s now proceed and install both JRE and JDK which both constitute JAVA
JRE
Ubuntu
sudo apt install default-jre
Arch
sudo pacman -S jre-openjdk
JDK
Ubuntu
sudo apt install default-jdk
Arch
sudo pacman -sS java | grep jdk
sudo pacman -S jdk-openjdk
you can check the version with java -version
java -version
Trying to run Eclipse Neon I'm getting this error:
To open “Eclipse” you need to install the legacy Java SE 6 runtime.
Instead of the legacy JRE, I have already installed JRE 1.8 from Oracle:
➜ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
However, I can also see it is not available in the path:
➜ java -v
No Java runtime present, requesting install.
➜ /usr/libexec/java_home -v 1.8
Unable to find any JVMs matching version "1.8".
No Java runtime present, try --request to install.
➜ ls /Library/Java/JavaVirtualMachines
On macOS you must install the full JDK to get complete Java support. The JRE is not sufficient as it only installs the browser plugins.
The current download for the JDK is here
I am trying to get jmxtrans to work yet I get the below on ubuntu 12.04 and using openjdk 7.
/usr/share/jmxtrans# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
/usr/share/jmxtrans# ./jmxtrans.sh start /var/lib/jmxtrans/kafka.json
Cannot execute /usr/lib/jvm/default-java/bin/jps -l!
What does the above mean?
It seems that the jps file can't be found in the /usr/lib/jvm/default-java/bin directory. It is available in the '-devel' packages if you want to install those (yum install java-1.7.0-openjdk-devel, apt-get install openjdk-7-jre-devel). It could also be that your JAVA_HOME is not pointing to the correct place if you have multiple java versions installed.
You should not need it however, regular ps works fine. You can add a variable to your configuration that says export USE_JPS=false. The configuration can be found in /etc/default/jmxtrans.
Check out these issues for more information:
https://github.com/jmxtrans/jmxtrans/issues/89
https://github.com/jmxtrans/jmxtrans/pull/109