Visual Studio Code Beginner Tutorial | Learn VS Code in 7 steps | Windows and Mac OS
HTML-код
- Опубликовано: 4 авг 2024
- automationstepbystep.com/
Hi, I am Raghav & today we will learn:
Visual Studio Code Step by Step
1. Download and setup - windows and Mac OS
2. GUI & Features
3. Components
4. Settings
5. How to create folders
6. How to create files
7. How to run code
8. Tips & Tricks
Step 1 : Download and open visual studio code
code.visualstudio.com/
Step 2 : Explore GUI
Step 3 : Command Pallete - ctrl + shift + P
Step 4 : Open folder
Step 5 : Create file
Step 6 : Add Extensions
Step 7 : Create and run code
#VisualStudioCode
References
code.visualstudio.com/docs#vs...
code.visualstudio.com/docs/ge...
C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code
SUBSCRIBE & Click Bell to Join Automation Step-by-Step family
JOIN me on this educational journey as a member and get exclusive perks - Click the JOIN button
/ @raghavpal
ONLINE COURSES TO LEARN
automationstepbystep.com/onli...
----------- UI TESTING -----------
Selenium Beginners - bit.ly/2MGRS8K
Selenium Java Framework from Scratch - bit.ly/2N9xvR6
Selenium Python - bit.ly/2oyMp5x
Selenium Tips - bit.ly/2owxc50
Selenium Builder - bit.ly/2MKNtlq
Katalon Studio - bit.ly/2wARFdi
Robot Framework with RIDE- bit.ly/2Px6Ue9
Robot Framework with Eclipse - bit.ly/2N8DZxb
----------- API TESTING -----------
Web Services (API) - bit.ly/2MGafL7
SoapUI - bit.ly/2MGahmd
Postman - bit.ly/2wz8LrW
General - bit.ly/2PYdwmV
Katalon Studio API Testing - bit.ly/2BwuCTN
----------- MOBILE TESTING -----------
Mobile Playlist - bit.ly/2PxpeUv
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - bit.ly/2MIn8EC
Jenkins Tips & Trick - bit.ly/2LRt6xC
Docker - bit.ly/2MInnzx
----------- VERSION CONTROL SYSTEM -----------
Git & GitHub - bit.ly/2Q1pagY
----------- PERFORMANCE TESTING -----------
JMeter Beginner - bit.ly/2oBbtIU
JMeter Intermediate - bit.ly/2oziNVB
JMeter Advanced - bit.ly/2Q22Y6a
JMeter Tips & Tricks - bit.ly/2NOfWD2
Performance Testing - bit.ly/2wEXbLS
----------- JAVA -----------
Java Beginners - bit.ly/2PVUcXs
Java Tips & Tricks - bit.ly/2CdcDnJ
----------- MAVEN -----------
Maven - bit.ly/2NJdDRS
----------- OTHERS -----------
Redis- bit.ly/2N9jyCG
Misc - bit.ly/2Q2q5xQ
Tools & Tips - bit.ly/2oBfwoR
QnA Friday- bit.ly/2NgwGpw
Sunday Special - bit.ly/2wB23BO
Ask Raghav - bit.ly/2CoJGWf
Interviews - bit.ly/2NIPPxk
All Playlists - bit.ly/2LSiezA
Keep Learning,
Raghav
Website - automationstepbystep.com/
LifeCharger - lifecharger.org/
Udemy Courses - www.udemy.com/user/raghav-pal-3/
Facebook - / automationstepbystep
Twitter - / automationsbs
RUclips - / automationstepbystep
You can support my mission for education here:
/ raghavpal
finally a video that shows step by step how to create code and run it
Glad to know
Thanks Raghav a lot...your videos are really helpful !! :)
You're welcome Anshuman
You have explained very well manner thank you Raghav!!
Thanks and welcome Mayank
Thank you sir I always looking your new video. Your explanation is amazing and in detail.
You're welcome Ashraf, Glad and humbled to know this.
Thank you Raghav for clear explanation
Thanks for liking Balaji
Hi Raghav, your web site is excellent. You could settle many useful video in one place. You need to update them as well because the new versions of software different from the previous versions. Anyway... many thanks. Great work!
Sure I will, thanks
thanks a lot Raghav !! its a great session for beginners to start. waiting for next session how to integrate VScode with azure devops
Will plan for this Nitu
Amazing !
Thanks for your message Mahesh
Nice Explanation!
Glad it was helpful Suresh
You are a gem ... Thankyou
Most welcome Maheen
Thanks it was really helpful
Glad to hear that Rutuja
讲的非常好,帮我省了很多时间
多谢
@Raghav pal hey im just starting to go through your js course and im following along with you but when i wrote the test.groovy code it returned the message groovy:comand not found even though i installed the code-groovy extension to my vs code
Hi, Pls check if groovy is installed on your system. ruclips.net/p/PLhW3qG5bs-L8T6v6DgsZo93DgYDmOF9u4
Thank you.
You're welcome Drew
Hai sir,I tried the basic hello world program but getting error as "Error: Could not find or load main class test.java",I installed the java extension pack...can u suggest me
Regards,
kalavathi jeeru
Hi Kalavathi, Where is your main method, pls check and run from there.
Hello Raghav, I am trying to follow your video, but when I try to run the code for [print "hello world..!"] it tells me "code language not supported or defined". What am I missing? What extensions do you have installed by the time you add the one for "run code"?
Ok I got my answer, it is important to name the file xxx.GROOVY otherwise it doesn't work
Hi Raghav,
I installed Playwright and Code Runner . I am trying to print Hello world as mentioned in video. But getting below error can you please help me with this error.
[Running] groovy "c:\Users\Admin\Desktop\Visual Studio Code\test.groovy"
'groovy' is not recognized as an internal or external command,
operable program or batch file
Hi Manju, is groovy installed on your system and is the path for groovy set in the system's PATH environment variable
Can check videos here ruclips.net/p/PLhW3qG5bs-L8T6v6DgsZo93DgYDmOF9u4
Hi Raghav,
I tried to run the Hello world, but came up with an error. Please suggest.
[Done] exited with code=1 in 0.357 seconds
'groovy' is not recognized as an internal or external command,
operable program or batch file.
Sagar
The error message `'groovy' is not recognized as an internal or external command, operable program or batch file.` means that VS Code cannot find the Groovy command. This can happen for a few reasons:
* Groovy is not installed on your computer.
* The Groovy installation directory is not in your PATH environment variable.
* You are using the wrong command to run Groovy scripts.
To fix this error, you can try the following:
1. **Make sure that Groovy is installed on your computer.** You can download Groovy from the official website.
2. **Add the Groovy installation directory to your PATH environment variable.** This will tell VS Code where to find the Groovy command. To do this, follow these steps:
* Open the Control Panel.
* Click on System and Security.
* Click on System.
* Click on Advanced system settings.
* Click on Environment Variables.
* Under System variables, find the Path variable and double-click on it.
* At the end of the Path variable value, add a semicolon (;) followed by the full path to the Groovy installation directory. For example, if you installed Groovy to the directory `C:\Program Files\Groovy`, you would add `;C:\Program Files\Groovy` to the Path variable value.
* Click OK to save your changes.
3. **Restart VS Code.**
Now, you should be able to run Groovy scripts in VS Code. To do this, open a Groovy script file in VS Code and click the Run button in the toolbar.
If you are still getting the error message after following these steps, you can try the following:
* Make sure that you are using the correct command to run Groovy scripts. The Groovy command is simply `groovy`.
* Try restarting your computer.
* Try reinstalling Groovy.
Hi Raghav. I tried to run the Hello world code on my end. I'm getting an error 'groovy' is not recognized as an internal or external command,
operable program or batch file.
What should I do about it? Is there any extension to add on for groovy?
Appreciate for help!!
Check if groovy is installed
I have the same problem, what do you mean by installing groovy?
Hi Raghav. How to use Selenium Webdriver in Visual Studio Code editor. Thanks for answer ?
Hi Mahri, I will try to do a series on this
Hi Raghav, I suppose you have installed groovy in your machine because you can run it, otherwise we get error 🙄
Yes Aggie. Just in case you need help with that, can check my groovy tutorials here - automationstepbystep.com/
Hey Raghav please do upload video's on how to install selenium in visual studio code and sample automation using Vscode
Hi Sowjanya, will do it
hello Raghav I following the steps ,using MAC but in output i am getting : [Running] groovy "/Users/sumaiya/Desktop/VScode/test.groovy"
/bin/sh: groovy: command not found
[Done] exited with code=127 in 0.022 seconds
Pls check if groovy folder was set in path env variables. Can check this video - ruclips.net/video/Fk12ELJ9Bww/видео.html
Hi Raghav,I am Unable to install code runner extension on visual video
Hi Rafi, what is the issue, Pls also check in installed extensions
Hai sir,
can we use testng annotations in visual studio code?
Hi Kalavathi, I believe testng is not yet available in the extension section in VS Code, but you can use Java Test Runner - github.com/Microsoft/vscode-java-test
hi, I am having this issue 'groovy' is not recognized as an internal or external command,
operable program or batch file. Can you please help?
Kiều
The error message you're seeing typically occurs when the system can't find the Groovy executable in your PATH environment variable. Here's how you can fix it:
1. Verify Groovy Installation: Ensure that Groovy is installed on your system. You can check this by typing `groovy -version` in the command prompt. If Groovy is installed, it will display the installed version.
2. Set Environment Variables:
- Right-click on 'This PC' or 'Computer' on your desktop or in File Explorer and select 'Properties'.
- Click on 'Advanced system settings' and then click on 'Environment Variables'.
- Under 'System variables', look for a variable named `GROOVY_HOME`. If it doesn't exist, create a new one with the name `GROOVY_HOME` and set its value to the path where Groovy is installed (e.g., `C:\Program Files\Groovy\Groovy-3.0.0`).
- Now, find the `Path` variable under 'System variables' and edit it. Add a new entry that points to the `bin` directory of your Groovy installation (e.g., `%GROOVY_HOME%\bin`).
3. Restart Command Prompt: After setting the environment variables, close any open command prompt windows and open a new one. This will refresh the environment variables.
4. Test Groovy Command: Type `groovy -version` again in the new command prompt window to verify that Groovy is now recognized.
@@RaghavPalhi, it's working now. Thank you so much.
Very informative thank you.
Is there any way to save our codes both locally and in git simultaneously ????
Hi Venkat, The code gets saved on local as you save your work, On git you have to commit and push. You can search and get script to run the git commands from a single file. There are also pugins, that you can use to do commits at pre-defined intervals. Check these
marketplace.visualstudio.com/items?itemName=zeitnergmbh.auto-git
stackoverflow.com/questions/34719129/visual-studio-code-push-automatically
Try and let me know what worked for you.
@@RaghavPal hello sir,
Thank you for reply, I have checked 3 rd video in this playlist it cleared my doubt. Now you also said how to commit to git automatically. Using auto git extension is easy. Thanks a lot.
Thank You Bro!!!
Only you had some sense to tell that we had to install Code Runner, whereas all other tutorials, including that of VSC did not mention it. I was so desperate that I felt like uninstalling VSC and just then I came across this one!
Happy to know it helped Vishnu
Hello Raghav.
Thanks for your videos.
Just started my first steps and here I am 😞
Using extension Code runner, I get following error message, when Trying run code println 'Hello world'
/bin/sh: groovy :command not found
Thanks for any recommendation to fix this
Levon
The error message "/bin/sh: groovy: command not found" means that the Groovy executable is not in the `PATH` environment variable. The `PATH` environment variable tells the shell where to look for executable files.
To fix this error, you need to add the directory where the Groovy executable is located to the `PATH` environment variable.
On Linux and macOS, you can do this by editing the `.bashrc` file. Open the `.bashrc` file in a text editor and add the following line to the end of the file:
```
export PATH=$PATH:
```
Replace `` with the actual path to the Groovy executable.
On Windows, you can do this by editing the `.bash_profile` file. Open the `.bash_profile` file in a text editor and add the following line to the end of the file:
```
export PATH=$PATH;
```
Replace `` with the actual path to the Groovy executable.
Once you have added the Groovy executable to the `PATH` environment variable, you should be able to run the Groovy code without any errors.
Here are some additional things you can try:
* Make sure that you have installed Groovy correctly.
* Make sure that the Groovy executable is executable.
* Try restarting VS Code.
I hope this helps
Thanks @@RaghavPal
Those are Path in zshrc file, but still no any success
export PATH="/usr/local/bin:$PATH"
export GROOVY_HOME=/opt/homebrew/opt/groovy/libexec
export PATH="$GROOVY_HOME/bin:$PATH"
can try some online help and examples
'groovy' is not recognized as an internal or external command,
operable program or batch file. i get this to run hello world, plz help
groovy is already installed
Hi Neha
This error message indicates that the Groovy executable is not in the system's PATH environment variable, which means that the system does not know where to find the Groovy executable.
To resolve this issue, you need to add the Groovy executable to your system's PATH environment variable. Here are the steps to do this on a Windows machine:
Open the Start menu and search for "Environment Variables" and click "Edit the system environment variables".
Click the "Environment Variables" button.
In the "System Variables" section, find the "Path" variable and click "Edit".
Click "New" and add the path to the directory where Groovy is installed (e.g., "C:\groovy\bin").
Click "OK" on all windows to save the changes.
Open a new command prompt and try running the Groovy command again.
After following these steps, you should be able to run the Groovy command from anywhere in the command prompt.
@@RaghavPal Thank yo so much for reply, i am able to do now. Thanks so much god bless.
'groovy' is not recognized as an internal or external command,
operable program or batch file. what to do as i've add extention of groovy
Hi Kapil
It looks like Groovy is not installed or configured properly on your system. Here are a few things you can try:
Make sure you have installed Groovy and its binary is added to your system's PATH environment variable. You can verify this by opening a new command prompt window and typing groovy -version. If it's not recognized, you need to add the binary to the PATH.
If you have installed Groovy and still getting the error, try restarting Eclipse and see if it recognizes the Groovy extension.
If the above steps don't work, you may need to reinstall the Groovy plugin in Eclipse. To do this, go to "Help" -> "Eclipse Marketplace" -> search for "Groovy" -> select "Groovy Eclipse" and click "Install".
If you are still having issues, you can try using a different IDE like IntelliJ IDEA or NetBeans, which has built-in support for Groovy.
I hope this helps!
@@RaghavPal ive done it thank you
I get = 'groovy is not recognised as an internal or external command...' when I run code ?
Steve
The error message "groovy is not recognized as an internal or external command" indicates that the Groovy interpreter is not installed on your system, or that the Groovy executable is not in your PATH environment variable.
To fix this error, you can install the Groovy interpreter or add the Groovy executable to your PATH environment variable.
**To install the Groovy interpreter:**
1. Download the Groovy binary distribution from the Groovy website.
2. Extract the binary distribution to a directory on your system.
3. Add the Groovy bin directory to your PATH environment variable.
**To add the Groovy executable to your PATH environment variable:**
1. Open the System Properties dialog box.
2. Click the Advanced tab.
3. Click the Environment Variables button.
4. In the System Variables section, find the PATH variable.
5. Click the Edit button.
6. Add the Groovy bin directory to the end of the PATH variable, separated by a semicolon (;).
7. Click the OK button.
8. Click the OK button.
9. Click the OK button.
Once you have installed the Groovy interpreter or added the Groovy executable to your PATH environment variable, you should be able to run Groovy code without any problems.
For example, if you have the following Groovy code in a file called `myscript.groovy`:
```groovy
println "Hello, world!"
```
You can run the code by typing the following command in a terminal window:
```
groovy myscript.groovy
```
This will print the following output to the terminal window:
```
Hello, world!
```
I hope this helps
@@RaghavPal many thanks, will try this 👍
Hi Raghav,
Could you please make a series on Proboscis or any equivalent framework to TestNG.
There are very few videos available for Selenium frameworks using python.
I'm a big fan of your videos and you teaching style, therefore asking for a video through your channel only.
Sure Sonam, I will add to my list
I am waiting for the Visual Basic Code Setting with Node Js
I will check on that Abhishek in some time
Hello,
wtf. I get:
ERROR: Environment varianble JAVA_HOME has not been set. Attempting to find JAVA_HOME from PATH also failed. Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
Johannes
Let's address the issue related to the `JAVA_HOME` environment variable in Visual Studio Code (VSCode).
1. Setting `JAVA_HOME` in VSCode:
- The `JAVA_HOME` environment variable points to the location of your Java installation. It's essential for tools like VSCode to locate the correct Java version.
- Follow these steps to set `JAVA_HOME`:
- Windows:
1. Press Windows + S and search for "Environment Variables."
2. Click on Edit the system environment variables.
3. In the System Properties window, click the Environment Variables button.
4. Under System variables, click New.
5. Enter `JAVA_HOME` as the variable name.
6. Set the variable value to the path where your JDK is installed (e.g., `C:\Program Files\Java\jdk1.8.0_161`).
7. Click OK to save the changes.
- macOS / Linux:
1. Open a terminal window.
2. Run the following command to find the path to your JDK:
```
echo $JAVA_HOME
```
3. If it's not set, set it using:
```
export JAVA_HOME=/path/to/your/jdk
```
Replace `/path/to/your/jdk` with the actual path to your JDK installation.
2. Verify `JAVA_HOME` in VSCode:
- After setting `JAVA_HOME`, restart VSCode.
- Open your Java project or file.
- VSCode should now recognize the correct Java version based on the `JAVA_HOME` environment variable.
3. Install Java Extension Pack:
- Install the Java Extension Pack for VSCode. It provides essential tools for Java development.
- Search for "Java Extension Pack" in the VSCode Extensions marketplace and install it.
4. Check Java Installation:
- Ensure that you have a Java Development Kit (JDK) installed on your system.
- You can download the JDK from the official Oracle website or use OpenJDK.
5. Restart VSCode:
- After making changes, close and reopen VSCode to apply the environment variable settings.
Remember to replace `/path/to/your/jdk` with the actual path where your JDK is installed. Once you've set `JAVA_HOME`, VSCode should recognize your Java installation correctly
..
Js with api? Series
I will plan
are u using windows or mac os in this video I am little confused ?? but btw thnx
Hi Siddhant, usually I keep both systems so it can be useful for both windows and mac users, Let me know if there was some specific part that you were not able to follow
@@RaghavPal no problem u actually cleared all my doubt thnx :D
it doesn't work with me :( the code is all the same color and i keep getting that my code language is not supported
I believe you are missing some extension. Pls check what language you are using, In case its groovy or javascript can check for related extensions in the extension section.
Automation Step by Step - Raghav Pal i wanna code with react native and i have already installed its extension! still the same
Hi Reem, I do not have much inputs on react native. Suggest you to check online
Sir ooper program run ka option symbol show nahi kar raha visual code mei
Hi Samreen, you will need to add some code runner extension
@@RaghavPal thank you sir
my code was running but not printing Hello World
please reply me
Hi Kapil, will need to check the code and troubleshoot. Try to do step by step debugging. Can also take some online examples and try
Getting an Error . Please help [Running] groovy "c:\Users\kys20\OneDrive\Desktop\VSCode\tempCodeRunnerFile.groovy"
'groovy' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.056 seconds
Kartik
Let's break down the error message and troubleshoot the issue step by step.
Error Message:
```
'groovy' is not recognized as an internal or external command, operable program or batch file.
```
What does it mean?
The error message indicates that the system cannot find the `groovy` command. This command is used to run Groovy scripts, and it's not recognized by the system as a valid command.
Possible Causes:
1. Groovy is not installed: Make sure you have Groovy installed on your system.
2. Groovy is not in the system's PATH: Even if Groovy is installed, the system may not be able to find it if the installation directory is not in the system's PATH environment variable.
Step-by-Step Solution:
1. Check if Groovy is installed:
* Open a new terminal or command prompt in VS Code by pressing `Ctrl + Shift + ` (Windows/Linux) or `Cmd + Shift + ` (Mac).
* Type `groovy -version` and press Enter. If Groovy is installed, you should see the version number. If not, you'll see an error message indicating that Groovy is not recognized.
2. Install Groovy if it's not installed:
* If Groovy is not installed, download and install it from the official Groovy website:
* Follow the installation instructions for your operating system.
3. Add Groovy to the system's PATH:
* After installing Groovy, you need to add the installation directory to the system's PATH environment variable.
* Right-click on Computer or This PC and select Properties.
* Click on Advanced system settings on the left side.
* Click on Environment Variables.
* Under System Variables, scroll down and find the Path variable, then click Edit.
* Click New and add the path to the Groovy installation directory (e.g., `C:\Program Files\Groovy\bin`).
* Click OK to close all the windows.
4. Restart VS Code:
* Close and restart VS Code to ensure the changes take effect.
5. Try running the Groovy script again:
* Go back to your VS Code editor and try running the Groovy script again by clicking the Run Code button or pressing `F5`.
-
Hey Ravi im getting this message -------- [Running] groovy "/Users/braveheart55/Documents/Programming Practice/Test.groovy"
/bin/sh: groovy: command not found
[Done] exited with code=127 in 0.008 seconds . What should i do from here and what groovy install may i need ? im doing this on a macbook pro
Michael
The error message you are getting means that the Groovy command is not found in your system path. This can happen if Groovy is not installed, or if it is not installed in the default location.
To fix this error, you can try the following steps:
1. Make sure that Groovy is installed. You can install Groovy using the Homebrew package manager. To do this, run the following command in your terminal:
```
brew install groovy
```
2. Verify that Groovy is installed in the default location. The default location is:
* macOS: `/usr/local/bin`
3. If Groovy is not installed in the default location, you can add the directory where Groovy is installed to your system path. To do this, open the `.bash_profile` file in your home directory and add the following line:
```
export PATH=$PATH:/path/to/groovy/install/directory
```
4. Once you have added Groovy to your system path, you can try running the Groovy command again.
5. If you are still getting the error message, you can try installing the Groovy extension for Visual Studio Code. This extension will allow you to run Groovy scripts directly from within Visual Studio Code.
To install the Groovy extension, open Visual Studio Code and go to the Extensions tab. Search for "Groovy" and install the extension by clicking on the "Install" button.
Once the extension is installed, you can run a Groovy script by opening the script in Visual Studio Code and clicking on the "Run" button.
I hope this helps
Here are some other things to keep in mind:
* Make sure that you are using the correct version of Groovy. The version that you are using must be compatible with the version of Visual Studio Code that you are using.
* Make sure that you have the correct permissions to run Groovy scripts. You may need to change the permissions on the directory where the Groovy script is located.
* If you are still having trouble, you can try contacting Groovy support for help.
Thank you soo much@@RaghavPal
Hi Raghav - I am getting the following error when I run the code -
[Running] groovy "c:\Users\manis\Desktop\VSCode training\test.groovy"
error: could not locate java home
[Done] exited with code=4294967295 in 0.212 seconds
How do I solve this?
Hi Manisha
The error message "could not locate java home" indicates that the Java Development Kit (JDK) is not properly installed or configured on your system. Here are some steps you can follow to solve this issue:
Check if Java is installed on your system by running the following command in your terminal or command prompt:
java -version
If Java is not installed, you need to download and install the latest JDK from the official Java website.
Once Java is installed, you need to set the JAVA_HOME environment variable to the path where the JDK is installed. To do this:
On Windows, go to Control Panel > System and Security > System > Advanced system settings > Environment Variables. Under System Variables, click on New and add a variable called JAVA_HOME with the path to the JDK installation folder (e.g., C:\Program Files\Java\jdk-16.0.2).
On macOS or Linux, open your terminal and run the following command:
export JAVA_HOME=/path/to/jdk
Replace /path/to/jdk with the actual path to your JDK installation folder.
After setting the JAVA_HOME environment variable, close and reopen your terminal or command prompt and run the java -version command again to verify that Java is properly installed and configured.
If you still get the same error message, try restarting your computer and running the command again.
Can also check more on this online
@@RaghavPal Hi Raghav, thank you for your detailed solution. I did all the steps, restarted my computer and also ran the command again.
This is what I am getting now -
[Running] groovy "c:\Users\manis\Desktop\VSCode training\test.groovy"
[Done] exited with code=0 in 7.442 seconds
What am I doing wrong now?
Manisha
If you are only seeing the message [Running] groovy "c:\Users\manis\Desktop\VSCode training\test.groovy" without any other output or error messages, it means that the Groovy script is running without any issues.
You should see the output of your Groovy script in the terminal. If your script is not printing anything to the console, you may need to add some print statements to see the output.
If you are still experiencing issues, please provide more information about the Groovy script and the context in which you are running it.