英文:
Unrecognized option: --module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred
问题
我尝试设置环境变量_JAVA_OPTION分配1GB内存。
英文:
trying to setup a JavaFX project for the first time on vscode
error keep showing:
Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
PS C:\Users\bisce\Desktop\coding\JavaProjects\FirstJavaFXProject>
I tried setting up the env variable _JAVA_OPTION to have 1GB of memory allocated.
attaching a screenshot of the launch.json file:
launch.json
Farewell
I tried setting up the env variable _JAVA_OPTION to have 1GB of memory allocated.
答案1
得分: 1
首先,确保你正在使用Java9或更高版本,然后在launch.json中配置[vmArgs
]:
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "App",
"request": "launch",
"mainClass": "application.Main",
"projectName": "FirstJavaFXProject",
"vmArgs": "--module-path C:/Java/java-sdk-20.0.1/lib --add-modules javafx.controls,javafx.fxml",
}
]
}
路径周围不要有单引号。
更多信息请参考此文档。
英文:
First you need to make sure you are using Java9 or higher, then configure vmArgs
in launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "App",
"request": "launch",
"mainClass": "application.Main",
"projectName": "FirstJavaFXProject",
"vmArgs": "--module-path C:/Java/java-sdk-20.0.1/lib --add-modules javafx.controls,javafx.fxml",
}
]
}
No single quotes around the path.
It will be more helpful to refer to this document.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论