I'm trying to make Java programs work on Visual Studio Code. I've downloaded the Microsoft extension, downloaded the JKE from Oracle, and now I'm trying to run the proverbial "Hello World" Java program to make sure it works. Here is my program (I got it from the "Get Started" tutorial so it should be fine):
class QuickStart {
public static void main(final String[] args) {
System.out.println("Hello, World.");
}
}
Here's what happens when I run it:
(my files)> cd 'c:\Users\Janet\Documents\Matthew's Homeschooling\VSC Programs\APCSA'; &
'c:\Users\Janet\.vscode\extensions\vscjava.vscode-java-debug-0.28.0\scripts\launcher.bat' 'C:\Program Files\Java\jdk-14.0.2\bin\java.exe' '--enable-preview' '-XX:+ShowCodeDetailsInExceptionMessages' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\Janet\AppData\Roaming\Code\User\workspaceStorage\5eda06847dc66aa5b01dbd290d4e0d18\redhat.java\jdt_ws\APCSA_a6725e29\bin' 'QuickStart'
>>
As you can see, it enters some weird shell. Then when I try running it again, I get this error:
>> cd 'c:\Users\Janet\Documents\Matthew's Homeschooling\VSC Programs\APCSA'; & 'c:\Users\Janet\.vscode\extensions\vscjava.vscode-java-debug-0.28.0\scripts\launcher.bat' 'C:\Program Files\Java\jdk-14.0.2\bin\java.exe' '--enable-preview' '-XX:+ShowCodeDetailsInExceptionMessages' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\Janet\AppData\Roaming\Code\User\workspaceStorage\5eda06847dc66aa5b01dbd290d4e0d18\redhat.java\jdt_ws\APCSA_a6725e29\bin' 'QuickStart'
Set-Location : A positional parameter cannot be found that accepts argument 's'.
At line:1 char:2
+ cd 'c:\Users\Janet\Documents\Matthew's Homeschooling\VSC Programs\AP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Hello, World.
So it does print out "Hello World.", but it spits out an error and I have to run it twice. How can I run my Java program without errors by running it once?
'And the script uses'to quote paths. Change the folder name fromMatthew's Homeschooling