Skip to content

Commit 4122658

Browse files
committed
updating files to include JUnit support, update serverless tutorial using extension
1 parent a781002 commit 4122658

14 files changed

Lines changed: 6158 additions & 80 deletions

docs/java/extensions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ To help set up Java on VS Code, there is a [Java Extension Pack](https://marketp
1919

2020
1. [Language Support for Java(TM) by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java)
2121
2. [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug)
22+
3. [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
2223

2324
<a class="tutorial-install-extension-btn" href="vscode:extension/vscjava.vscode-java-pack">Install the Java Extension Pack</a>
2425

26+
In case you're working on Spring Boot, there's also a [Spring Boot Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=Pivotal.vscode-boot-dev-pack) developed by Pivotal.
27+
2528
## Recommended extensions for cloud (Azure) development
2629

2730
Along with the language support, if you are deploying your applications to the cloud, especially Azure, there is a [Azure Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-azureextensionpack) which contains extensions for popular Azure Services:
886 KB
Loading
1.63 MB
Loading
1 MB
Loading
1.48 MB
Loading
114 KB
Loading
108 KB
Loading
113 KB
Loading
115 KB
Loading

docs/java/java-debugging.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
Order: 5
33
Area: java
4-
TOCTitle: Debugging
4+
TOCTitle: Debugging and Testing
55
ContentId: 929e5410-3bfe-4107-b331-565afe5d341f
6-
PageTitle: Debugging Java in VS Code
6+
PageTitle: Debugging and Testing Java in VS Code
77
DateApproved: 11/14/2017
8-
MetaDescription: See how you can debug your Java code locally, and in the cloud.
8+
MetaDescription: See how you can debug and test your Java code locally, and in the cloud.
99
MetaSocialImage:
1010
---
1111
# Debugging Java in VS Code
@@ -30,12 +30,14 @@ Here's a list of supported debugging features:
3030

3131
Just like VS Code, the debugger is an open source project which welcomes contributors to collaborate with us through our GitHub repositories:
3232

33-
[Debugger for Java Extension](https://github.com/Microsoft/vscode-java-debug)
34-
[Java Debugger Server for Visual Studio Code](https://github.com/Microsoft/java-debug)
33+
- [Debugger for Java Extension](https://github.com/Microsoft/vscode-java-debug)
34+
- [Java Debugger Server for Visual Studio Code](https://github.com/Microsoft/java-debug)
35+
36+
To run and debug JUnit test, you can install [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test), which is another lightweight extension we developed. You can also view test log from the extension.
3537

3638
## Install
3739

38-
For the debugger to work, you also need to have the [Language Support for Java(TM) by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) with your VS Code installed. To make it easier, we provide a [Java Extension Pack](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) which bundles both the [Language Support for Java(TM) by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) and the [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug).
40+
For the debugger to work, you also need to have the [Language Support for Java(TM) by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) with your VS Code installed. To make it easier, we provide a [Java Extension Pack](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) which bundles the [Language Support for Java(TM) by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java), the [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) as well as the [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test).
3941

4042
The first time you edit a Java file, you will be prompted to install the extension pack. You can also install it manually from the Extension view (`kb(workbench.view.extensions)`). In the Extension view search box, type `vscode-java-pack`.
4143

@@ -63,21 +65,37 @@ Even if there's just a single Java file without any project, you can use VS Code
6365

6466
The Java debugger also supports external source files. This lets you debug third party classes when they are inside a JAR or a source attachment. Just set your breakpoints in those classes before you start debugging. Java 9 is supported with VS Code as well.
6567

68+
![Java 9 Support](images/java-debugging/java9.gif)
69+
70+
The default Debug Console in VS Code doesn't support inputs. In case your program need inputs from terminal, you can use integrated terminal within VS Code or external terminal to launch it.
71+
72+
![Launch in Terminal](images/java-debugging/launch-in-terminal.gif)
73+
74+
There're a lot of different [options and settings](#_options) available with this Debugger. For example, configuring cwd and environment variables could be easily done with launch options.
75+
76+
![Configure Variables](images/java-debugging/cwd-env.gif)
77+
6678
Please also check the documentation of [Language Support for Java by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) if you have trouble setting up your project.
6779

6880
## Options
6981

7082
### Launch
7183

72-
- `mainClass` (required) - The main class of the program (fully qualified name, for example `com.xyz.MainClass`).
84+
- `mainClass` (required) - The main class of the program (fully qualified name, e.g. [mymodule/]com.xyz.MainClass).
7385
- `args` - The command line arguments passed to the program.
7486
- `sourcePaths` - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
87+
- `modulePaths` - The modulepaths for launching the JVM. If not specified, the debugger will automatically resolve from current project.
7588
- `classPaths` - The classpaths for launching the JVM. If not specified, the debugger will automatically resolve from current project.
76-
- `encoding` - The `file.encoding` setting for the JVM. If not specified, 'UTF-8' will be used. Possible values can be found in [Supported Encodings](http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html).
89+
- `encoding` - The `file.encoding` setting for the JVM. If not specified, 'UTF-8' will be used. Possible values can be found in http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html.
7790
- `vmArgs` - The extra options and system properties for the JVM (e.g. -Xms\<size\> -Xmx\<size\> -D\<name\>=\<value\>).
7891
- `projectName` - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program.
7992
- `cwd` - The working directory of the program.
8093
- `env` - The extra environment variables for the program.
94+
- `stopOnEntry` - Automatically pause the program after launching.
95+
- `console` - The specified console to launch the program. Defaults to `internalConsole`.
96+
- `internalConsole` - VS Code debug console (input stream not supported).
97+
- `integratedTerminal` - VS Code integrated terminal.
98+
- `externalTerminal` - External terminal that can be configured in user settings.
8199

82100
### Attach
83101

@@ -90,11 +108,20 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
90108
### User Settings
91109

92110
- `java.debug.logLevel`: minimum level of debugger logs that are sent to VS Code, defaults to `warn`.
111+
- `java.debug.settings.showHex`: show numbers in hex format in "Variables" viewlet, defaults to `false`.
112+
- `java.debug.settings.showStaticVariables`: show static variables in "Variables" viewlet, defaults to `true`.
113+
- `java.debug.settings.showQualifiedNames`: show fully qualified class names in "Variables" viewlet, defaults to `false`.
114+
- `java.debug.settings.maxStringLength`: the maximum length of string displayed in "Variables" or "Debug Console" viewlet, the string longer than this length will be trimmed, defaults to `0` which means no trim is performed.
93115

94116
## Feedback and Questions
95117

96118
You can find the full list of issues at [Issue Tracker](https://github.com/Microsoft/vscode-java-debug/issues). You can submit a [bug or feature suggestion](https://github.com/Microsoft/vscode-java-debug/issues/new), and participate in the community driven [Gitter](https://gitter.im/Microsoft/vscode-java-debug) channel.
97119

120+
## Run JUnit Tests
121+
[Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) allows you to run and debug your test cases.
122+
123+
![JUnit support](images/java-debugging/junit.gif)
124+
98125
## Next Steps
99126

100127
Read on to find out about:

0 commit comments

Comments
 (0)