Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38935

Re: Invoke java with JavaFX

From Knute Johnson <groups@585ranch.com>
Newsgroups comp.lang.java.programmer
Subject Re: Invoke java with JavaFX
Date 2019-04-23 21:54 -0500
Organization A noiseless patient Spider
Message-ID <q9oj5t$6o7$1@dont-email.me> (permalink)
References <JavaFX-20190424012305@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 4/23/2019 7:35 PM, Stefan Ram wrote:
>    Old programmers might remember that in early JDKs one had to write
> 
> javac Main.java
> java Main
> 
>    while today we can write just
> 
> java Main.java
> 
>    to execute the program.
> 
>    But is this also possible with JavaFX?
> 
>    Today, I use /two/ commands to start a JavaFX application
>    from »Main.java«: First,
> 
> ..\jdk-11.0.1\bin\javac -p "...\javafx-sdk-11.0.1\lib"
> --module-path "...\javafx-sdk-11.0.1\lib"
> --add-modules=javafx.controls,javafx.swing Main.java
> 
>    and then,
> 
> ..\jdk-11.0.1\bin\java -p "...\javafx-sdk-11.0.1\lib;."
> --module-path "...\javafx-sdk-11.0.1\lib"
> --add-modules=javafx.controls,javafx.swing Main
> 
>    (each a single line, wrapped here for the post;
>    »...« indicates initial path fragments omitted in this post)
> 
>    I tried to merge the lines into one, trying both
> 
> ..\jdk-11.0.1\bin\java -p "...\javafx-sdk-11.0.1\lib;."
> --module-path "...\javafx-sdk-11.0.1\lib"
> --add-modules=javafx.controls,javafx.swing Main.java
> 
>    with »;.« and
> 
> ..\jdk-11.0.1\bin\java -p "...\javafx-sdk-11.0.1\lib"
> --module-path "...\javafx-sdk-11.0.1\lib"
> --add-modules=javafx.controls,javafx.swing Main.java
> 
>    without »;.«. But both threw strange error messages at me.
> 
>    So, is the simplification to a single command only
>    possible for simple cases?
> 
>    Or did I miss anything about how to merge these two
>    lines properly?
> 
> 

If you include the . in the path when running java -cp . Main.java and 
there is a Main.class in the class path it won't work.  You get this 
error: error: class found on application class path: YourApp.

I also don't think you need the -cp "...\javafx-sdk-11.0.1\lib" part either.

knute...

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: Invoke java with JavaFX Knute Johnson <groups@585ranch.com> - 2019-04-23 21:54 -0500

csiph-web