Home  >  Article  >  Java  >  How to write java in VS Code

How to write java in VS Code

(*-*)浩
(*-*)浩Original
2019-05-14 11:27:4745891browse

How to write Java in vscode: First download VSCode and install and run it; then click the extension icon on the left side of the interface to install the JDK and configure environment variables; then install the Java extension and open a Java code file; finally right-click the editing window , and select "Run Code".

How to write java in VS Code

In many cases, I just want to write a very simple Java program with only a few lines of code and see the results. Although Visual Studio / Eclipse / IntelliJ IDEA is powerful, it is too heavy and feels like overkill when used.

Recommended course: Java Tutorial.

Now there is an additional option, which is to use Visual Studio Code (VS Code), a powerful text editor launched by Microsoft. You can take a look at the effect first:

How to write java in VS Code

First of all, there must be some prerequisites

Download VS Code and install it, run VS Code, click on the on the left Extension icon,
How to write java in VS Code
Then search for and install the following extension:
How to write java in VS Code
How to write java in VS Code

Steps required to run Java code

Install the latest version of JDK and JRE (download page)
How to write java in VS CodeConfigure Java system path parameters (refer to this article for the method, where the JDK installation path should be set according to the actual installation path) ​

After the installation is complete, enter java -version and javac -version in the command prompt or PowerShell. If the correct Java version number is displayed, it means that the previous The configuration is already correct.
How to write java in VS CodeSearch and install the following extensions in VS Code
How to write java in VS Code ​ ​​

Open a Java code file, right-click the editing window, and select Run Code, the program running results will be displayed in the Terminal window.
How to write java in VS Code When writing a program using a new file, you need to click the Plain Text button in the lower right corner or press Ctrl KM), select the language as Java.
How to write java in VS Code

Now you can write Java programs in it.

The above is the detailed content of How to write java in VS Code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn