简体   繁体   中英

JavaFX - On Windows 10 can I set an environment variable instead of using command line classpath switch?

There's a book called "Java How to Program Early Objects" and a section describes compiling some .java files importing some JavaFX code. The book lists the following command to do it

javac *.java

This leads to a bunch of package javafx.xxx does not exist errors because it can't find the JavaFX libraries. Now I can use the -cp switch and it works:

javac -cp "D:\Program Files\Java\JavaFX14.0.2.1\lib\*"; *.java

However I was wondering if on a Windows 10 system I could set an environment variable so the command looks identical to the one in the book. Haven't been able to find anything. TIA

H/T to @dave_thompson_085 for putting me on the right track. The answer is a bit non-intuitive which is why I missed it at first.

Create an environment variable CLASSPATH, but instead of adding just the folder, you need to specify a wild card (so it looks EXACTLY like the command above) like so:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM