Closed aliShreef closed 4 years ago
I have now played with JDK-8 and JDK-11 versions using Windows command line.
git clone --branch jdk-8 https://github.com/JonathanGiles/scenic-view.git
cd scenic-view
gradle assemble run
For the current JDK-11 compatible version, this worked:
git clone https://github.com/JonathanGiles/scenic-view.git
cd scenic-view
gradlew build run
When starting manually, ensure that the JavaFX runtime is available (https://openjfx.io) One can download the runtime here: https://gluonhq.com/products/javafx/
set PATH_TO_FX="path\to\javafx-sdk-11\lib"
Then continue building and running the Scenic-View. Scenic-View requires different JavaFX modules. Manually launching Java requires to provide the individual modules. The module javafx.base
must not be provided manually, as it is a transitive depenedency of the other modules.
git clone https://github.com/JonathanGiles/scenic-view.git
cd scenic-view
gradlew build
cd build\libs
java --module-path %PATH_TO_FX% --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web -jar scenicview.jar
Well, having JDK-11 installed in Windows, on PowerShell it worked for me like that:
$env:JAVA_HOME="C:\Program Files\Java\jdk-11.0.2"
$env:PATH_TO_FX="D:\Test3\javafx-sdk-11.0.2\lib"
Set-Alias java "C:\Program Files\Java\jdk-11.0.2\bin\java.exe"
cd D:\Test3
git clone https://github.com/JonathanGiles/scenic-view.git
cd scenic-view
./gradlew assemble
cd build/libs
java --module-path $env:PATH_TO_FX --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web -jar .\scenicview.jar
Not to forget, the $env:PATH_TO_FX=
setting is adjusted to my system. This must be customized.
According to build.gradle
, the JavaFX Swing module is needed as well. This will be relevant, when the JFXPanel
is used in the project to be analysed. In this case, the java command shall look as follows:
java --module-path $env:PATH_TO_FX --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.swing -jar .\scenicview.jar
@Oliver-Loeffler , thank you so much for your valuable replay to my point. actually i am able to run the jar now from power shell with this command :
java --module-path $env:PATH_TO_FX --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.swing -jar .\scenicview.jar
, but nothing display. look :
also, when i follow your way for JDK 11 , i got this error when run this command :
gradlew build run
note that , i set PATH_TO_FX as it is as variable name , and set the value of the variable to my local javaFX SDK lib directory
should i start my application along with scenic-view in order to load the hierarchy of view ?
In PowerShell instead of gradlew build run
you must type ./gradlew build run
.
Yes, you have to run your application along with Scenic-View. Scenic-View permanently scans for JavaFX applications around.
The ThreeDom will only work, when started as a project dependency. Well, I haven't this tried yet with JDK-11 version.
Button button = new Button("Hello");
VBox vbox = new VBox(button);
Scene scene = new Scene(vbox);
primaryStage.setScene(scene);
primaryStage.show();
// only works, if Scenic-View has been added as a dependency to your project
ScenicView.show(scene);
i do not know what i say actually , you save my all life.
currently i am able to run the jar from power shell correctly , but i still can not run it by just double click. when i double click jars , nothings is happen and when i run from power shell like this
i got
classNotFoundException
what is the issue or i am missing if i am able to run it from power shell but not from just clicking on it ?
Double clicking the JAR is equivalent to the attempt of running the jar with javaw -jar scenicview.jar
or java -jar scenicview.jar
. The required dependencies (in module path) are not available, thus there will be a ClassNotFoundException
somewhere.
Instead, you could write a BATCH or CMD file which is then executed, it could look like:
start-scenic-view.cmd
@echo off
javaw --module-path %PATH_TO_FX% --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web -jar %LOCATION_OF_JAR%\scenicview.jar
%LOCATION_OF_JAR%
directory where your JAR is located
%PATH_TO_FX%
is your path\to\javafx-sdk-11\libThis batch file will be runnable via double click. Well, it would be also possible to create an image with JLink but here I am not yet so familar with.
Thank you so much for your support @Oliver-Loeffler , you help me a lot. i appreciate it .
I am trying to run the jar file from lib folder , but nothing happen.
also i tried to run it from CMD but i got this message :
and this is my JAVA_HOME & JRE_HOME variable.
thank you.