VLC cannot find Java

How come VLC doesn’t find my Java?

Java required: This Blu-ray disc requires Java for menus support. Java was not found on your system. The disc will be played without menus.

Here’s where Java seems to be installed:

dad@DadsGram~ $ java -version
openjdk 19.0.2-internal 2023-01-17
OpenJDK Runtime Environment (build 19.0.2-internal-adhoc.mockbuild.corretto-19-19.0.2.7.1)
OpenJDK 64-Bit Server VM (build 19.0.2-internal-adhoc.mockbuild.buildavx2, mixed mode)
dad@DadsGram~ $ whereis java
java: /usr/bin/java

Also, it looks like JAVA_HOME is not populated (should it be?):

dad@DadsGram~ $ echo $JAVA_HOME

dad@DadsGram~ $

What am I doing wrong?

Check for missing dependencies:

ldd $(which vlc) | grep "not found"

If none is missing, try :

export JAVA_HOME=/usr/lib/jvm/java-19-openjdk

export PATH=$JAVA_HOME/bin:$PATH

If that works, add both exports to your .bashrc

If not, try the VLC flatpak :

flatpak install flathub org.videolan.VLC

flatpak run org.videolan.VLC
1 Like

Here goes:

dad@DadsGram~ $ ldd $(which vlc)
which: no vlc in (/usr/bin/haswell:/usr/bin:/usr/local/bin:/opt/3rd-party/bundles/clearfraction/bin:/opt/3rd-party/bundles/clearfraction/usr/bin:/opt/3rd-party/bundles/clearfraction/usr/local/bin:/opt/3rd-party/bin)
ldd: missing file arguments
Try `ldd --help' for more information.

as per skimming through a few reddit threads,
libbluray used in VLC doesn’t support the latest java
I recommend you try an older Java like Java 11. Get one from here https://adoptium.net/temurin/releases/?os=linux&arch=x64&version=11

i use GitHub - jenv/jenv: Manage your Java environment
Place the extracted jdk into ~/.local/lib/jvm/
then point jenv towards it.

1 Like

Thanks. I like this jEnv thingie! Now, my current Java comes form CL’s java-basic bundle, and I would like to add it to jenv, only I do not know where it’s installed. So the question is, where exactly does the java-basic bundle install Java?

Later on I will install the Java you recommended, should the one from java-basic doesn’t do the trick.

Find out with :

which java

echo $JAVA_HOME

Have a look at this directory :

/usr/lib/jvm

If you have OpenJDK 11 installed, it might be here :

/usr/lib/jvm/java-11-openjdk

Here goes:

dad@DadsGram~ $ which java
/usr/bin/java
dad@DadsGram~ $ java -version
Command not found at Using system JDK, no JAVA_HOME set!/bin/java.
JAVA_HOME=Using system JDK, no JAVA_HOME set!
dad@DadsGram~ $ echo $JAVA_HOME
Using system JDK, no JAVA_HOME set!

What can you tell from the above? Is Java installed in usr/bin/?

Also:

Does that mean that there’s another Java installed in /usr/jvm/java-1.19.0??

/usr/bin/java

is probably a symlink, check with : 

ls -l /usr/bin/java

Check the contents of /usr/jvm/java-1.19.0 to confirm it’s a valid Java installation.

Look for a bin directory within it that contains the java executable

You can replace the /usr/bin/java symlink with one that links to the binary in the dir.

To make your current install work :

export JAVA_HOME=/usr/jvm/java-1.19.0

export PATH=$JAVA_HOME/bin:$PATH

Add both lines to your ~/.bashrc to make it permanent.

Reload .bashrc : 

source ~/.bashrc


1 Like
jenv add /usr/lib/jvm/java-1.19.0/

for my local java, i copy the path using .local

jenv add .local/lib/jvm/jdk-17.0.13+11/

use jenv versions to check which versions you have available.

Thanks, guys, I’ll be following your advice and report back. Nevertheless, my question at this point is, why do I have to go through all this ordeal? I mean, all I did was install the official CL java-basic bundle. Shouldn’t this have taken care of the Java path and all that? Why is it that my installing this bundle did not populate the requisite environment variables? Is that the CL policy: install the bundle, but leave it to the end user to agonize over where exactly the software has been installed, and what environment variables need to be populated? Most of the times one doesn’t even know exactly what software comes with a bundle, let alone what environment variables need to be set manually. Isn’t is safe to say that once one installs some bundle, one should be able to use it immediately, without chasing installation locations and environmant variables?

If you’re not in need of multiple Java installations (like im currently doing), jenv is not required and you can just export JAVA_HOME directly in your .bashrc file

For searching exact file paths, I use swupd search-file

As for populating the needed env variables beforehand, probably CL team can help us with that

1 Like