|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + |
| 4 | +<head> |
| 5 | + <meta charset="UTF-8"> |
| 6 | + <meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'"> |
| 7 | + <title>Java Getting Started</title> |
| 8 | +</head> |
| 9 | + |
| 10 | +<body> |
| 11 | + <div class="container mt-5 mb-5"> |
| 12 | + <div class="row mb-3"> |
| 13 | + <div class="col"> |
| 14 | + <h1 class="font-weight-light">Java Getting Started</h1> |
| 15 | + </div> |
| 16 | + </div> |
| 17 | + <div class="row"> |
| 18 | + <div class="col"> |
| 19 | + <div class="card"> |
| 20 | + <div class="card-body"> |
| 21 | + <div class="row"> |
| 22 | + <div class="col d-block d-md-none"> |
| 23 | + <ul class="nav nav-tabs mb-3" role="tablist"> |
| 24 | + <li class="nav-item"> |
| 25 | + <a class="nav-link active" id="quick-start-tab" data-toggle="tab" href="#quick-start-panel" role="tab" aria-controls="quick-start-panel" aria-selected="true" title="">Quick Start</a> |
| 26 | + </li> |
| 27 | + <li class="nav-item d-none"> |
| 28 | + <a class="nav-link" id="files-folders-tab" data-toggle="tab" href="#files-folders-panel" role="tab" aria-controls="files-folders-panel" aria-selected="false" title="">Files & Folders</a> |
| 29 | + </li> |
| 30 | + <li class="nav-item"> |
| 31 | + <a class="nav-link" id="code-editing-tab" data-toggle="tab" href="#code-editing-panel" role="tab" aria-controls="code-editing-panel" aria-selected="false" title="">Code Editing</a> |
| 32 | + </li> |
| 33 | + <li class="nav-item"> |
| 34 | + <a class="nav-link d-none" id="compile-build-tab" data-toggle="tab" href="#compile-build-panel" role="tab" aria-controls="compile-build-panel" aria-selected="false" title="">Compile & Build</a> |
| 35 | + </li> |
| 36 | + <li class="nav-item"> |
| 37 | + <a class="nav-link" id="debugging-tab" data-toggle="tab" href="#debugging-panel" role="tab" aria-controls="debugging-panel" aria-selected="false" title="">Debugging</a> |
| 38 | + </li> |
| 39 | + <li class="nav-item d-none"> |
| 40 | + <a class="nav-link" id="projects-dependencies-tab" data-toggle="tab" href="#projects-dependencies-panel" role="tab" aria-controls="projects-dependencies-panel" aria-selected="false" title="">Projects</a> |
| 41 | + </li> |
| 42 | + <li class="nav-item d-none"> |
| 43 | + <a class="nav-link" id="customize-tab" data-toggle="tab" href="#customize-panel" role="tab" aria-controls="customize-panel" aria-selected="false" title="">Customize</a> |
| 44 | + </li> |
| 45 | + <li class="nav-item"> |
| 46 | + <a class="nav-link" id="faq-tab" data-toggle="tab" href="#faq-panel" role="tab" aria-controls="faq-panel" aria-selected="false" title="">FAQ</a> |
| 47 | + </li> |
| 48 | + </ul> |
| 49 | + </div> |
| 50 | + </div> |
| 51 | + <div class="row"> |
| 52 | + <div class="col"> |
| 53 | + <div class="tab-content"> |
| 54 | + <div class="tab-pane fade show active" id="quick-start-panel" role="tabpanel" aria-labelledby="quick-start-tab"> |
| 55 | + <p>Welcome to Visual Studio Code!<br/> |
| 56 | + In this 1-minute tutorial, we'll show you how to create a quick-start Java program in VS Code. |
| 57 | + </p> |
| 58 | + <h3 class="font-weight-light">Setup the Workspace</h3> |
| 59 | + <p> |
| 60 | + To setup the workspace, simply open a folder by: |
| 61 | + <dl class="row"> |
| 62 | + <dt class="col-sm-3">Windows</dt> |
| 63 | + <dd class="col-sm-9">File > <a href="command:workbench.action.files.openFileFolder">Open Folder...</a></dd> |
| 64 | + <dt class="col-sm-3">Mac</dt> |
| 65 | + <dd class="col-sm-9">File > <a href="command:workbench.action.files.openFileFolder">Open...</a></dd> |
| 66 | + </dl> |
| 67 | + </p> |
| 68 | + <blockquote class="card-body"> |
| 69 | + <h5 class="font-weight-light">No Import Needed</h5> |
| 70 | + <p class="mb-0"> |
| 71 | + VS Code Java works directly with <strong>folders</strong> that have source code. If the folder you open has project/build configuration files like <code>pom.xml</code> or <code>build.gradle</code>, they will be picked up automatically and the folder will be treated as a project. |
| 72 | + </p> |
| 73 | + </blockquote> |
| 74 | + <h3 class="font-weight-light">Create a Class</h3> |
| 75 | + <p> |
| 76 | + A program needs an entry and a Java program needs a class to host its entry. To create a class for our quick-start program, <a href="command:explorer.newFile">create a file</a> and set its name to <code>QuickStart.java</code>.<br/> |
| 77 | + Now you can put the code in the new file: |
| 78 | + </p> |
| 79 | + <blockquote class="card-body"> |
| 80 | +<pre class="mb-0"><code>class QuickStart { |
| 81 | + public static void main(String[] args) { |
| 82 | + System.out.println("Hello, World."); |
| 83 | + } |
| 84 | +}</code></pre> |
| 85 | + </blockquote> |
| 86 | + <h3 class="font-weight-light">Run the program</h3> |
| 87 | + <p> |
| 88 | + To run the program, press <a href="command:workbench.action.debug.start"><kbd>F5</kbd></a>. By default, the program is launched in the <a href="command:workbench.action.terminal.toggleTerminal">Intergrated Terminal</a>. You should already see the output there. |
| 89 | + </p> |
| 90 | + <blockquote class="card-body"> |
| 91 | + <h5 class="font-weight-light">How to Debug?</h5> |
| 92 | + <p class="mb-0"> |
| 93 | + When you press <a href="command:workbench.action.debug.start"><kbd>F5</kbd></a>, you are already debugging. Try set some breakpoint by clicking on the line numbers before each code line and run the program again. You'll see the execution paused at the breakpoint.<br/> |
| 94 | + While debugging, switch to the <a href="command:workbench.view.debug">Debug View</a> to see the variables and call stacks. |
| 95 | + </p> |
| 96 | + </blockquote> |
| 97 | + <h3 class="font-weight-light">Congratulations!</h3> |
| 98 | + <p> |
| 99 | + Now the quick-start program is running and you are free to build more.<br/> |
| 100 | + What you saw is just a tiny part of VS Code Java. You can do much more with it. Feel free to explore: |
| 101 | + </p> |
| 102 | + <dl class="row mb-0" id="navigationPanel"> |
| 103 | + <dt class="col-sm-3"><a href="#code-editing-tab">Code Editing</a></dt> |
| 104 | + <dd class="col-sm-9">Learn more about Refactoring, Code Completion, and Linting</dd> |
| 105 | + <dt class="col-sm-3"><a href="#debugging-tab">Debugging</a></dt> |
| 106 | + <dd class="col-sm-9">Learn more about Breakpoints, Variables, Threads, and Call Stacks</dd> |
| 107 | + <dt class="col-sm-3"><a href="#faq-tab">FAQ</a></dt> |
| 108 | + <dd class="col-sm-9">Frequently asked questions</dd> |
| 109 | + </dl> |
| 110 | + </div> |
| 111 | + <div class="tab-pane fade" id="files-folders-panel" role="tabpanel" aria-labelledby="files-folders-tab"> |
| 112 | + <p>How to deal with files and folders</p> |
| 113 | + </div> |
| 114 | + <div class="tab-pane fade" id="code-editing-panel" role="tabpanel" aria-labelledby="code-editing-tab"> |
| 115 | + <p>Explore code editing features</p> |
| 116 | + </div> |
| 117 | + <div class="tab-pane fade" id="compile-build-panel" role="tabpanel" aria-labelledby="compile-build-tab"> |
| 118 | + <p>Understand the compile and build mechanism of the language server</p> |
| 119 | + </div> |
| 120 | + <div class="tab-pane fade" id="debugging-panel" role="tabpanel" aria-labelledby="debugging-tab"> |
| 121 | + <p>How to use the debugger</p> |
| 122 | + </div> |
| 123 | + <div class="tab-pane fade" id="projects-dependencies-panel" role="tabpanel" aria-labelledby="projects-dependencies-tab"> |
| 124 | + <p>How to deal with projects and dependencies</p> |
| 125 | + </div> |
| 126 | + <div class="tab-pane fade" id="customize-panel" role="tabpanel" aria-labelledby="customize-tab"> |
| 127 | + <p>How to customize vs code</p> |
| 128 | + </div> |
| 129 | + <div class="tab-pane fade" id="faq-panel" role="tabpanel" aria-labelledby="faq-tab"> |
| 130 | + <p>Frequently asked questions</p> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + </div> |
| 134 | + <div class="col-3 d-none d-md-block"> |
| 135 | + <div class="list-group list-group-flush" role="tablist"> |
| 136 | + <a class="list-group-item list-group-action active" id="quick-start-tab" data-toggle="list" href="#quick-start-panel" role="tab" aria-controls="quick-start-panel" aria-selected="true" title="">Quick Start</a> |
| 137 | + <a class="list-group-item list-group-action d-none" id="files-folders-tab" data-toggle="list" href="#files-folders-panel" role="tab" aria-controls="files-folders-panel" aria-selected="false" title="">Files & Folders</a> |
| 138 | + <a class="list-group-item list-group-action" id="code-editing-tab" data-toggle="list" href="#code-editing-panel" role="tab" aria-controls="code-editing-panel" aria-selected="false" title="">Code Editing</a> |
| 139 | + <a class="list-group-item list-group-action d-none" id="compile-build-tab" data-toggle="list" href="#compile-build-panel" role="tab" aria-controls="compile-build-panel" aria-selected="false" title="">Compile & Build</a> |
| 140 | + <a class="list-group-item list-group-action" id="debugging-tab" data-toggle="list" href="#debugging-panel" role="tab" aria-controls="debugging-panel" aria-selected="false" title="">Debugging</a> |
| 141 | + <a class="list-group-item list-group-action d-none" id="projects-dependencies-tab" data-toggle="list" href="#projects-dependencies-panel" role="tab" aria-controls="projects-dependencies-panel" aria-selected="false" title="">Projects</a> |
| 142 | + <a class="list-group-item list-group-action d-none" id="customize-tab" data-toggle="list" href="#customize-panel" role="tab" aria-controls="customize-panel" aria-selected="false" title="">Customize</a> |
| 143 | + <a class="list-group-item list-group-action" id="faq-tab" data-toggle="list" href="#faq-panel" role="tab" aria-controls="faq-panel" aria-selected="false" title="">FAQ</a> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | + </div> |
| 147 | + </div> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </div> |
| 152 | +</body> |
| 153 | + |
| 154 | +</html> |
0 commit comments