Linux Vscode+CMake+GCC/G++/Java environment configuration

1. C++ configuration environment

C++ configuration adopts cmake+ g++/gcc mode

gcc/g++ installation

sudo apt-get install gcc g++

cmake installation
1. Download:
https://cmake.org/download/

SkyDrive cmake1.9 https://share.weiyun.com/CTixvEtg

2. Unzip. Add environment variable
vi .bashrc
export PATH=/home/cmake-3.19/bin:$PATH
source .bashrc

Test:
cmake -version

2. Java environment configuration

step:

2.1 Install JDK

Online installation

Another article has been written
https://blog.csdn.net/weixin_41477306/article/details/101152856

Offline installation

Link: https://pan.baidu.com/s/1opnnV-FWj42eRgaB3IUn_A
Extraction code: ai29

Download the java-8-openjdk-amd64.tar.gz inside,
unzip it to the HOME directory,
and configure the environment variables

//1.解压
tar -xvf java-8-openjdk-amd64.tar.gz  

//2.配置环境变量
cd ~ 
vi .bashrc      
//打开.bashrc 后将下面内容拷贝到最后
export JAVA_HOME=/home/A-KPC-0472/java-8-openjdk-amd64
export JRE_HOME=${
    
    JAVA_HOME}/jre
export CLASSPATH=.:${
    
    JAVA_HOME}/lib:${
    
    JRE_HOME}/lib
export PATH=${
    
    JAVA_HOME}/bin:$PATH

//3.测试java 
java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~16.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

2.2 Configure vscode

Online configuration

First attach the official website link, the official website also explains how to use and develop Java programs in VSCode
https://code.visualstudio.com/docs/languages/java

VSCode can develop different languages ​​through many plug-ins. First download the plug-ins for developing Java programs. There are four recommended plug-ins on the official website:

  1. Language Support for Java™ by Red Hat
  2. Debugger for Java
  3. Java Test Runner
  4. The belly of Java

Reference: https://www.cnblogs.com/zhaoshizi/p/9524421.html

In the process of running java, it may report:
VS Code report error: Java 11 or more recent is required to run. Please download and install a recent JDK
solution

There are two solutions to this problem:
Option 1:

Since the minimum version supported by the v0.64.1 version is Java 11, you can install Java 11 on your computer and point the environment variable to the Java 11 home, so you can use it normally. After this process, the project compilation and other operations can still use Java 8 or other versions, but this requires some configuration in the project configuration file.
Option II:

Upgrading Java 11 is not the only solution. In many cases, it is not convenient for us to upgrade the Java version. Another way to do this is to roll back this plug-in to a lower version. As long as the version is before v0.64.1 . Then remember to turn off the automatic update of VS Code, otherwise the plug-in will be upgraded back in minutes (if the network is in good condition). The method of rollback is shown in the figure below.
Insert picture description hereClick the settings button in the lower right corner of the plugin, select "Install Another Version", and then select the version before v0.64.1.

Note: JDK version generally install openjdk version "1.8.0_265" // Jump between other versions of java files will fail
JDK1.8.0_265 download address
https://github.com/ojdkbuild/ojdkbuild/releases/tag/java-1.8 .0-openjdk-1.8.0.265-1.b01-x86

Offline configuration

Link: https://pan.baidu.com/s/1opnnV-FWj42eRgaB3IUn_A
Extraction code: ai29

vscode installation
Download code-stable-1600965670.tar.gz and unzip it

Guess you like

Origin blog.csdn.net/weixin_41477306/article/details/108569314