Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher - Sonatype Nexus Repository - Sonatype Community

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

Post by ai.shakirov1 on Oct 6, 2023

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:

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)

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?

Post by robert.ziebarth on Oct 6, 2023

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).

Post by ai.shakirov1 on Oct 9, 2023

Thank you, the issue was with mv command.