java - getting started with JavaFX and environment variables
问题描述
I'm following the official tutorial to get started with JavaFX, and I'm on the step where you set the environment variable PATH_TO_FX
. The tut provides two ways to set it, one for linux/mac and one for windows.
I am using Git Bash, which I think is supposed to simulate linux commands on a windows system (please correct me if I'm wrong).
I have tried to set the variable like so:
Linux/Mac:
export PATH_TO_FX=C:/Program\ Files/JavaFX/javafx-sdk-11.0.2/lib/
Windows:
set PATH_TO_FX="C:/Program Files/JavaFX/javafx-sdk-11.0.2/lib/"
The first way gives me an error that C:/Program is not a valid identifier
, I think because of the space in the file path. I thought the \
was the escape character that would allow a space.
The Windows command gives me no feedback, but when I navigate to my environment variables in windows settings, the variable is not there. I can of course add it in the environment variables menu, but I'd like to understand the command line a bit better.
I have tried putting the path in quotation marks, and I tried with and without the escape slash that way too.
I have tried just putting "Program Files" in quotation marks, as one of the answers suggests.
I have tried the linux variation with and without a $
before the variable name.
I have also tried the Windows variation with and without the %%
around the variable name.
I tried the windows variation in cmd
as well as Git Bash.
Why is this happening and how do I fix it?
Also, a side question:
Is it it pretty normal that following the directions exactly don't work? It sure seems like it. Every time I want to set up a new system, library, IDE to learn how it works, I must first spend 5+ hours trouble shooting the installation. Following official directions never seems to work for me. Is this something I just have to get used to?
解决方案
The command SET is used to change the values of environment variables or to create new variables. In order to create user environment variables you have to use the command SETX , so that you have to use: SETX PATH_TO_FX "C:/Program Files/JavaFX/javafx-sdk-11.0.2/lib/"
推荐阅读
- javascript - 将不同键的值放入单个数组
- flutter - 在按钮单击时使用未来构建器刷新主页上的数据 - 颤动
- mysql - 查询从两列获取比较结果
- c++ - 如何在 Mac 中向 CLion 添加开源库?
- mysql - 节点 mysql2 无法访问更新结果
- javascript - 验证不适用于未捕获的类型错误:无法读取未定义的属性“顶部”
- node.js - 将参数从 Google Cloud 函数 GET 请求传递到 BigQuery
- perforce - 即使我将它们添加到 perforce changlist 也没有要提交的文件
- karate - 空手道 - 不能用 != [] 匹配每个
- c# - SslStream - 身份验证失败,因为远程方已关闭传输流