Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher

I am receiving an error message: “Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher”.

Here is some information about my environment:

  • OS: Ubuntu 22.04.3 LTS
  • Kernel: 6.2.0-1009-aws
  • CPU: 2
  • RAM: 8Gb
  • Architecture: x86_64
  • Java: openjdk version “1.8.0_382”
    OpenJDK Runtime Environment (build 1.8.0_382-8u382-ga-1~22.04.1-b05)
    OpenJDK 64-Bit Server VM (build 25.382-b05, mixed mode)
  • Nexus: 3.61.0-02 (also tried 3.59.0-01)

Steps to reproduce:

sudo apt update -y && sudo apt upgrade -y
sudo apt install openjdk-8-jre-headless -y
#(Also tried openjdk-8-jdk)
sudo mkdir /opt/nexus
sudo useradd -d /opt/nexus -s /bin/bash nexus
sudo passwd nexus

sudo tee /etc/security/limits.d/nexus.conf <<EOF
nexus - nofile 65536
EOF

curl -L -O https://download.sonatype.com/nexus/3/latest-unix.tar.gz
tar -xzf latest-unix.tar.gz
sudo mv nexus*/* /opt/nexus
sudo mv sonatype-work /opt/
sudo chown -R nexus:nexus /opt/nexus /opt/sonatype-work
sudo sed -i ‘s/#run_as_user=“”/run_as_user=“nexus”/g’ /opt/nexus/bin/nexus.rc

#I haven’t changed the memory configuration, because it’s a temporary VM, after successful #installation I will install it on the production VM.

sudo tee /etc/systemd/system/nexus.service <<EOF
[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
TimeoutSec=600

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable nexus.service --now

I have searched for solutions online, but have not been able to find a resolution to this issue. Could you please guide how to resolve this error and successfully install Nexus Repository 3 on my environment?

Not sure if this will help:

The class file com.install4j.runtime.launcher.UnixLauncher is contained in the jar file ‘[nexus-installation].install4j\i4jruntime.jar’.
The folder starts with a dot ‘.’ - this means the folder is hidden.
Does the jar file exist in your filesystem and are the permissions correct?

‘chown’ with ‘-R’ should honor the hidden folder ‘.install4j’ but I am not quite sure about ‘mv’ (sudo mv nexus*/* /opt/nexus).

1 Like

Thank you, the issue was with mv command.