0% found this document useful (0 votes)
22 views4 pages

Setup C++, Java, Python in VS Code

This document provides a step-by-step guide to installing and configuring Visual Studio Code (VS Code) for running C++, Java, and Python on Windows. It includes instructions for downloading necessary compilers, setting environment variables, integrating each programming language into VS Code, creating code files, and using the Code Runner extension to execute code. The guide concludes with a verification step to ensure that the setup works correctly for all three languages.

Uploaded by

2950molta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

Setup C++, Java, Python in VS Code

This document provides a step-by-step guide to installing and configuring Visual Studio Code (VS Code) for running C++, Java, and Python on Windows. It includes instructions for downloading necessary compilers, setting environment variables, integrating each programming language into VS Code, creating code files, and using the Code Runner extension to execute code. The guide concludes with a verification step to ensure that the setup works correctly for all three languages.

Uploaded by

2950molta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Complete Guide to Running C++, Java, and

Python in VS Code (Windows)


Step 1: Install VS Code
1. Download Visual Studio Code.
2. Run the installer and follow the on-screen instructions.
3. Open VS Code after installation.

Step 2: Install C++, Java, and Python


Install C++ (Compiler: MinGW-w64 or MSYS2)

1. Download MinGW-w64 from: [Link]


2. Install it and select gcc during installation.
3. Add the bin folder path to Environment Variables:

 Go to Control Panel → System → Advanced System Settings → Environment


Variables.
 Find Path, click Edit, and add:

C:\mingw-w64\bin

4. Verify installation: Open Command Prompt (Win + R → cmd → Enter) and run:

g++ --version

Install Java (JDK - Java Development Kit)

1. Download JDK (Java SE Development Kit) from:


[Link]
2. Install it and ensure you check “Add to PATH”.
3. Verify installation: Open Command Prompt and run:

java -version
javac -version

Install Python

1. Download Python from: [Link]


2. During installation, check the box “Add Python to PATH”.
3. Verify installation: Open Command Prompt and run:

python --version
Step 3: Integrate Each Language into VS Code
C++ Integration

1. Open VS Code.
2. Go to Extensions (Ctrl + Shift + X).
3. Search for "C/C++" (by Microsoft) and install it.

Java Integration

1. Open VS Code.
2. Go to Extensions (Ctrl + Shift + X).
3. Search for "Extension Pack for Java" and install it.

Python Integration

1. Open VS Code.
2. Go to Extensions (Ctrl + Shift + X).
3. Search for "Python" (by Microsoft) and install it.

Step 4: Create and Save Code Files in VS Code


For C++

1. Open VS Code.
2. Click File → New File.
3. Type your C++ code and save it as [Link] in a folder.

Example:

#include <iostream>
using namespace std;
int main() {
cout << "Hello, C++!";
return 0;
}

For Java

1. Open VS Code.
2. Click File → New File.
3. Save it as [Link].
Example:

java
CopyEdit
public class Main {
public static void main(String[] args) {
[Link]("Hello, Java!");
}
}

For Python

1. Open VS Code.
2. Click File → New File.
3. Save it as [Link].

Example:

print("Hello, Python!")

Step 5: Install Code Runner (Run Code Without Terminal


Commands)
1. Open VS Code.
2. Go to Extensions (Ctrl + Shift + X).
3. Search for "Code Runner" (by Jun Han) and install it.
4. Restart VS Code after installation.

. Using the "Code Runner" Extension (Easiest Method)

Steps to Install & Use Code Runner:

1. Open VS Code and go to Extensions (Ctrl + Shift + X).


2. Search for "Code Runner" and install it.
3. Open your code file (.cpp, .java, .py).
4. Click the Run (▶) button at the top-right corner or press:
o Ctrl + Alt + N → Runs the code automatically.

 Works for C++, Java, and Python (compiles & runs automatically).

For C++ (Run Without Terminal Commands)

 Open [Link].
 Click the Run (▶) button at the top-right.
 Or press: Ctrl + Alt + N (Code Runner shortcut).

For Java (Run Without Terminal Commands)

 Open [Link].
 Click the Run (▶) button at the top-right.
 Or press: Ctrl + Alt + N.

For Python (Run Without Terminal Commands)

 Open [Link].
 Click Run (▶) button.
 Or press: Ctrl + Alt + N.

Step 7: Verify Everything Works


Test each language:

1. C++: Run [Link] and check for "Hello, C++!".


2. Java: Run [Link] and check for "Hello, Java!".
3. Python: Run [Link] and check for "Hello, Python!".

If all work correctly, your setup is complete!

Quick Summary (For Reference)

Step Task Action


1 Install VS Code Download from VS Code
2 Install C++ Install MinGW-w64, add to PATH, verify g++ --version
3 Install Java Install JDK, add to PATH, verify java -version
4 Install Python Install Python, add to PATH, verify python --version
5 Add Extensions Install C/C++, Java Pack, and Python extensions
6 Create Code Files Write and save .cpp, .java, and .py files
7 Install Code Runner Install Code Runner extension
8 Run Code Press Ctrl + Alt + N or click Run (▶) button

You might also like