无法访问jarfile MyApp.jar

时间:2018-12-20 00:41:57

标签: java bash maven javafx

我对JavaFX有问题, 我创建了一个应用程序,现在我想通过bash文件运行该应用程序,当我去验证JRE内没有JavaFX的版本时,我尝试执行在openfx站点上找到的运行过程,仅目前,应用程序运行引发以下异常。   什么问题?

我的bash文件

#!/bin/bash
echo Welcome in My Code
echo The software has been developed by Vincenzo and Stefano
if [[ -d $HOME/dati ]]; then 
    echo "Bentornato"
fi

if type -p java; then
    echo found java executable in PATH
    _java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]];  then
    echo found java executable in JAVA_HOME     
    _java="$JAVA_HOME/bin/java"
else
    echo "no java"
fi

if [[ "$_java" ]]; then
    version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
    echo version "$version"
    if [[ "$version" -le "1.8.0" ]]; then
        echo "Versione java OK"
        sudo chmod +x my-code/MyCode.jar
        java -jar my-code/MyCode.jar
    else         
        echo "La versione java non potrebbe supportare il frameworck java fx"
        echo "Posso provare a sistemare le cose che ne dici? (y or n)"
        read esito
        if [[ "$esito" = "y" ]]; then
            export MYCODEFX=my-code/lib
            echo "Ok proviamo ad avviarla"
            chmod +x my-code/MyCode.jar
            java -jar MyCode.jar --module-path $MYCODEFX --add-modules=javafx.controls
        fi
        if [[ "$esito" = "n" ]]; then
            echo "Mi dispiace l'applicazione non puo' avviarsi"
        fi
    fi
fi

Java 10错误

Error: Unable to access jarfile MyCode.jar

ps:使用Java 8的应用程序可以正常工作(同一个jar)

0 个答案:

没有答案