cmabad / ViHoMa

Visual Hosts file Manager
GNU General Public License v3.0
46 stars 1 forks source link

Problem running under Linux #3

Open Sadi58 opened 4 years ago

Sadi58 commented 4 years ago

Tried both openjdk-8-jre and the default openjdk-11-jre, but received the same terminal output: Error: Could not find or load main class application.Main

cmabad commented 4 years ago

Hi, thanks for trying Vihoma. That error raises when the JavaFX packages are not found (they are not installed by default alongside the Java Runtime Environment).

If you are on Linux, it can be installed with your distro package manager (e.g, apt install openjfx).

For other operating systems, visit the JavaFX webpage, where the package can be easily downloaded and installed. That should fix the problem.

Sadi58 commented 4 years ago

Thanks. Sorry for my oversight. However, I still can't make enough progress unfortunately. The terminal output now is:

Error: Could not find or load main class application.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application 

By the way, I attempted to improve the file "vihoma.sh" in this way for Kubuntu - perhaps it may further be improved by also including a zenity dialog box, etc.:

#!/usr/bin/env bash
# get sudo password
sudo_password=$( kdialog --title "Authentication Required" --password "<b><big>ViHoMa</big></b><br><br>An application is attempting to perform an action that requires admin privileges. Authentication is required to perform this action." -- : 2>/dev/null )
# check for null entry or cancellation
if [[ ${?} != 0 || -z ${sudo_password} ]]
then
    exit 4
fi
if ! sudo -kSp '' [ 1 ] <<<${sudo_password} 2>/dev/null
then
    exit 4
fi
# begin
# readlink follows any symbolic links to get the real file
REALVIHOMAPATH=`dirname "$(readlink -nf $0)"`
sudo -Sp '' java -jar "${REALVIHOMAPATH}/vihoma.jar" "$@" <<<${sudo_password}
Unlocked8235 commented 10 months ago

I also had the same problem. Turns out OpenJDK doesn't include the JavaFX Library. OracleJDK however does. I tried manually setting up JavaFX for OpenJDK, but failed. Installed OracleJDK, set it as default in my terminal and now ViHoMa works like a dream by executing vihoma.sh