Javac not found

I’ve followed instructions for installing the openJDK into Fedora from https://docs.fedoraproject.org/en-US/quick-docs/installing-java/ using the command

sudo dnf install java-latest-openjdk

After doing so the javac command is not in the path. I then ran the command to select java11.

sudo alternatives --config java

But the path still does not contain javac. I also closed and reopened the terminal to see if the path would update to no avail. Is there a document describing how to install and select the javac command? The command “java -version” does return version 11. However commands “javac -version” and “which javac” return command not found.

I did find javac in /usr/share/bash-completions/completions/javac by changing to the root directory and using the command:

sudo . -name javac -print

I’m assuming I need to add alternatives for javac?

Hi @ksanger . Welcome to the community. Please take a minute to go through the posts in the #start-here category if you have not had a chance to do yet.

So.
javac is the Java compiler, right?
Maybe it is not included in the java-latest-openjdk package, because it is a development tool.
Indeed if you install java-latest-openjdk-devel, you can find javac.

In addition, are you sure that installing java-latest-openjdk it install openjdk version 11?

1 Like

Thanks; I had assumed that openjdk was a java developement kit ie java development kit. I’ll install java-latest-openjdk-devel next. I would have named openjdk openjre. Then the name would mean it was a java runtime environment and not a java development kit. Which it is. Must be missing something as openjdk without a javac command makes no sense to me.

1 Like

openJDK is simply the name of the upstream project, and so that is what all the related packages in Fedora are named.

http://openjdk.java.net/


The -devel package you were going to install next includes any bits that are required for development.

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_devel_packages

Fedora packages must be designed with a logical separation of files. Specifically, -devel packages must be used to contain files which are intended solely for development or needed only at build-time. This is done to minimize the install footprint for users.

openjdk follows the same scheme

2 Likes

As of 6/13/2019 latest installed version 12. Two days ago latest installed 11. I had to specify version 11 to get what we needed using:

sudo dnf install java-11-openjdk-devel

Then used alternatives --config to select the javac that we wanted to use.

sudo alternatives --config javac

And verify by invoking the compiler with the -version switch.

javac -version

Thanks everyone for all your help.