I tried to install Java IDK using https://www.oracle.com/java/technologies/downloads/#jdk18-linux and wget as well as uncompressing it using tar but when I tried to sudo apt dpkg install on it, it would result in the error:
dpkg: error:
archive 'jdk-20.0.2' is not a regular file.
What does it mean and how can I fix it?
- Installed https://www.oracle.com/java/technologies/downloads/#jdk18-linux using wget
- Got back jdk-20_linux-aarch64_bin.tar.gz, then went to Downloads directory
- Unpackaged jdk-20_linux-aarch64_bin.tar.gz using tar zxvf
- Tried to sudo dpkg -i jdk-20_linux-aarch64_bin.tar.gz
- "dpkg: error: archive 'jdk-20.0.2' is not a regular file"
You cannot install a tar.gz file using dpkg — it's not a .deb package, and dpkg does not know what to do with it.
If you only need to install Java for your user and not systemwide, you could do the following:
This would extract the contents of the archive into a directory called
jdk-20.0.2. Now create the.bin/javadirectory in your home folder:Now copy the
jdk-20.0.2folder into your new folder:Now you will need to edit your shell configuration file, it should be .bashrc by default:
Add the following lines to this config file:
Press Ctrl-o to save the changes and Ctrl-x to exit the editor.
Now you need to source your shell configuration file:
Verify that you can run the Java VM by using the following command:
Now you can delete the file you downloaded and the unpacked folder: