The Snyk quick user guide (Java)
Snyk is a developer security platform that enables application and cloud developers to
secure their whole application — finding and fixing vulnerabilities from their first lines of code
to their running cloud.
I. Sign up
1.1. Go to the Snyk website: https://snyk.io/ → Sign up
1.2. Select sign up for an account. For example, select to sign up with a Google account.
1
1.3. Sign in the Google account. Choose Continue to sign up
1.4. After Sign in the Google account. Choose Skip for now
2
1.5. Dashboard of your account on Snyk
II. Configure
2.1. On your Dashboard → Choose Setting
3
2.2. On Setting → DeepCode AI Fix → Enable DeepCode AI Fix
III. Using Snyk with Visual Studio Code IDE (VS Code)
After installing VS Code and opening VS Code (see installation and configuration
instructions in part IV. Visual Studio Code IDE (VS Code) below)
4
3.1. Install Snyk extension
- Choose Extension or press keys: Ctrl + Shift + X
- Type Snyk to filter
- Choose Snyk Security
- Choose Install
(2) Type Snyk
(3)
(4)
(1)
- After Install, the Snyk icon on the Activity Bar
5
3.2. Synk with Java
3.3.1. Open Java project folder: Choose File → Open Folder or Ctrl +K
After browser to Java project folder: Choose Select Folder
6
If this folder opened the first time by VS Code, VS Code will display the Workspace Trust
dialog. Then, select Yes, I trust the authors to enable all features in the workspace. Example,
we opened folder c:\temp\vscode101
7
3.3.2. Using Snyk to analyze code: Click the Snyk icon on the Activity Bar
8
Snyk to analyze code report: Example, code quality, Snyk found 1 issue, then suggest
using valueOf at line 47
3.3.3. DeepCode AI fix: Click Generate AI fix
9
Snyk AI suggests 4 solutions. We choose the best solution and click Apply fix
IV. Visual Studio Code IDE (VS Code)
4.1. Download
4.1.1. Go to the website: https://code.visualstudio.com/
10
4.1.2. Choose Download for Windows to download
4.2. Install
4.2.1. Open VSCodeUserSetup-x64-1.96.2.exe
11
4.2.2. After the Installer opens, it will ask you to accept the terms and conditions of the
Visual Studio Code. Click on I accept the agreement and then click the Next button.
4.2.3. By default, the Visual Studio Code installation location displayed on the screen.
However, you can choose a different location by clicking the “Browse” button and selecting a
different directory. Then click on the Next button.
12
1
4.2.4. Select Additional Tasks. You can choose to create a start menu folder for VS Code
or leave it unchecked if you prefer not to have a start menu entry. Then click on the Next button.
13
1: if none
4.2.5. The installer may provide additional options, such as creating a desktop icon,
adding Visual Studio Code to the PATH environment variable, or installing additional
components. Review these options and make your selections based on your preferences. Then
click on the Next button.
14
(1)
(2)
4.2.6. Click the Install button to begin the installation process.
15
4.2.7. Once the installation is complete, you can launch Visual Studio Code by clicking
the Finish button in the installer:
16
4.2.8. The icon of Visual Studio Code on Desktop.
4.3. The basic user interface
Now that you have a folder open in VS Code, we take a quick tour of the user interface.
4.3.1. Switch between views with the Activity Bar
4.3.1.1. Use the Activity Bar to switch between different views.
17
4.3.1.2. When you select a view in the Activity Bar, the Primary Side Bar opens
to show view-specific information. For example, the Run and Debug view enables you to
configure and start debugging sessions.
4.3.2. View and edit files with the Editor
4.3.2.1. Select the Explorer view in the Activity Bar, and select the New Untitled
Text File button to create a new file in your workspace.
18
4.3.2.2. Click Select a language.
4.3.2.3. Choose Java (java)
19
4.3.2.4. Start typing some code in the file.
As you type, you should see suggestions popping up that help you complete your code
(IntelliSense). You can use the Up and Down keys to navigate the suggestions, and Tab to insert
the selected suggestion.
20
4.3.2.5. Click the icon Save All, then type the file name and choose Save. A file
added to your workspace and an Editor opens in the main area of the window. Example, file
name is JavaBasic.java
4.3.2.6. Add more files to your workspace and notice that each file opens a new
Editor tab. You can open as many editors as you like and view them side by side vertically or
horizontally.
21
4.4. Configure run Java on VS Code
4.4.1. Go to the website: https://code.visualstudio.com/docs/languages/java
22
4.4.2. Choose Install the Coding Pack for Java - Windows to download
23
4.4.3. Run JavaCodingPack-0.4.2.exe
4.4.4. Check I accept the terms in the License Agreement → click Next
24
4.4.5. Click Install.
4.4.6. Check Launch Visual Studio Code → click Finish
25
4.4.7. We can Open Folder to open exist project or Create Java project
26