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


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

Re: Invoke java with JavaFX

Started byKnute Johnson <groups@585ranch.com>
First post2019-04-23 21:54 -0500
Last post2019-04-23 21:54 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#38935 — Re: Invoke java with JavaFX

FromKnute Johnson <groups@585ranch.com>
Date2019-04-23 21:54 -0500
SubjectRe: Invoke java with JavaFX
Message-ID<q9oj5t$6o7$1@dont-email.me>
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...

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web