VS Code系统找不到指定的路径



我正试图在VS代码上运行我的学校作业,但我得到这个错误。我已经在家里运行了我的代码,它总是工作得很好,但是这个文件就是不想运行。

这是我从终端

得到的结果
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:UsersoraveGoogle DriveAPCSAPROG 2Introduction & Analysis of AlgorithmsSorting Statsselection&insertionSort>  & 'c:Usersorave.vscodeextensionsvscjava.vscode-java-debug-0.31.0scriptslauncher.bat' 'C:Program FilesAdoptOpenJDKjdk-11.0.9.101-hotspotbinjava.exe' '-Dfile.encoding=UTF-8' '-cp' 'C:UsersoraveAppDataRoamingCodeUserworkspaceStorage3e4f84fdbcb8ec16980a673d4ef46a02redhat.javajdt_wsselection&insertionSort_48006976bin' 'sortingAlgorithms'
Usage: java [options] <mainclass> [args...]
(to execute a class)
or  java [options] -jar <jarfile> [args...]
(to execute a jar file)
or  java [options] -m <module>[/<mainclass>] [args...]      
java [options] --module <module>[/<mainclass>] [args...]
(to execute the main class in a module)
or  java [options] <sourcefile> [args]
(to execute a single source-file program)
Arguments following the main class, source file, -jar <jarfile>,
-m or --module <module>/<mainclass> are passed as the arguments to
main class.
where options include: // just some arguments
The system cannot find the path specified.

我显然不能在其他帖子上留言,除非我赢得了足够的声誉。我想请您分享您正在尝试运行的代码以及您认为可能有助于更好地理解导致此问题的问题的任何其他信息。自上次运行代码以来,发生了什么变化?

我看到你的PATH中有一个空格,在这里:

C:UsersoraveGoogle DriveAPCSAPROG

我在过去的VS Code中遇到过这样的问题,其中像这样的PATH不起作用:

C:Program FilesMicrochipxc8v2.32binxc8.exe

错误信息:

C:Usersraymu_000DocumentsProgrammingVisualStudioCodePIC_C_on_VSCodeL298N-
MotorDriver_Test>C:Program FilesMicrochipxc8v2.32binxc8.exe
--chip=16f887 --outdir="./output-files" --output=lpp "./Project/init-PWM.c"
'C:Program' is not recognized as an internal or external command, operable program or batch file.

这可以通过添加引号"来解决。围绕特定路径

"C:Program FilesMicrochipxc8v2.32binxc8.exe"

或者这样写:

C:Progra~1Microchipxc8v2.32binxc8.exe

但是我坚持,你应该在你的问题中加入更多的背景。希望这对你有帮助。

我打开VS code到我的学校文件夹,而不是我的项目文件夹,编译器希望运行在与主文件相同的文件夹

@Ray-Nevarez:没错,文件夹路径中的空间是问题所在。我也遇到过类似的问题——在某些情况下,更改默认文件夹可能没有帮助,因为人们没有权利更改它,或者出于某些原因不想更改路径。在VSCode中包含文件的完整路径可能会更好-它对我来说很有效。我的文件夹路径在Google Drive G:My DriveVSCODES....我在三个不同的地方使用三台不同的电脑。我更喜欢在任何地方同步文件,方便地工作,而不用远程连接到另一台电脑。注意:请确保在文件夹名称中加上引号。例如:G:My DriveVSCODE, (My Drive应该是"My Drive".

最新更新