VS Code The system cannot find the path specified

Viewed 6958

I'm trying to run my school assignment on VS code, but I'm getting this error. I've already been running my code from home and it always worked just fine but this file just doesn't want to run.

This is what I get from the terminal

Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\orave\Google Drive\APCSA\PROG 2\Introduction & Analysis of Algorithms\Sorting Stats\selection&insertionSort>  & 'c:\Users\orave\.vscode\extensions\vscjava.vscode-java-debug-0.31.0\scripts\launcher.bat' 'C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\bin\java.exe' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\orave\AppData\Roaming\Code\User\workspaceStorage\3e4f84fdbcb8ec16980a673d4ef46a02\redhat.java\jdt_ws\selection&insertionSort_48006976\bin' '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.
3 Answers

I apparently cannot leave comments on other posts until I have earned enough reputation. I was going to ask you to share the code you are trying to run and any additional information you think might help to better understand the issue that is causing this. What changed since the code was last running?

I see that there is a space in your PATH, here:

C:\Users\orave\Google Drive\APCSA\PROG

I have had issues with this in the past on VS Code where a PATH like this will not work:

C:\Program Files\Microchip\xc8\v2.32\bin\xc8.exe

Error message:

C:\Users\raymu_000\Documents\Programming\VisualStudioCode\PIC_C_on_VSCode\L298N-
MotorDriver_Test>C:\Program Files\Microchip\xc8\v2.32\bin\xc8.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.

This can be solved by adding quotation marks "" around the specific path

"C:\Program Files\Microchip\xc8\v2.32\bin\xc8.exe"

or writing it like this:

C:\Progra~1\Microchip\xc8\v2.32\bin\xc8.exe

But I insist, you should add more context to your question. Hope this helps in some way.

I opened VS code into my school folder, not my project folder, the compiler wants to be run in the same folder as the main file.

@Ray-Nevarez: Rightly, the space in the folder path is the problem. I had a similar issue - Changing the default folder may not help in some situation where one does not have right to change it or would not want to change the path for some reasons. It could be better to include the full path to the file on VSCode - it worked for me. My folder path was on Google Drive G:\My Drive\VSCODES.... I am using three different PCs in three different locations. I prefer to sync my files and conveniently work from any of the locations without connecting remotely to another PC. NOTE: Make sure to include the folder name with space in quotes. For example: G:\My Drive\VSCODE, (My Drive should be "My Drive").

Related