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


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

Re: Invoke java with JavaFX

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <groups@585ranch.com>
Newsgroups comp.lang.java.programmer
Subject Re: Invoke java with JavaFX
Date Tue, 23 Apr 2019 21:54:51 -0500
Organization A noiseless patient Spider
Lines 59
Message-ID <q9oj5t$6o7$1@dont-email.me> (permalink)
References <JavaFX-20190424012305@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Wed, 24 Apr 2019 02:54:54 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="03cef5b86377129aacf59c772841021a"; logging-data="6919"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gc4JJ1tx/muug8r5gn64w"
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
Cancel-Lock sha1:xqVL+9HWci6ocH9wmZwd/cm9N0o=
In-Reply-To <JavaFX-20190424012305@ram.dialup.fu-berlin.de>
Content-Language en-US
Xref csiph.com comp.lang.java.programmer:38935

Show key headers only | 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