Once you’ve accepted those, you’ll be able to visit your running application using the provided URL:
You can view console output in the Debug tab at the bottom of your screen.
Stop the server
To halt the execution of a running app, use the Command button at the top of your screen:
The Port tab at the bottom of your screen lists all the running projects and reminds you of what URL goes to what project. You can stop any project from there.
How about some Kotlin?
I’ve been on a Kotlin kick lately, so let’s try something a bit more exotic for VS Code and import a Kotlin project to work on. To import the project, I follow the same basic steps we did for the .NET-HTMX project:
Running the Kotlin project takes a little more finagling to figure out. First, I right-click on the imported build.gradle.kts file. This yields a context menu that includes “Gradle” along with a Run task option. Opening this leads to another context menu where I have the option to run a Gradle task. I type run and the console gives the expected output as the server starts up:
When I open the port, I can view my application running. After a page refresh, the Gradle extension provides a Gradle tab on the left side of my screen, which exposes tasks like Run in its drop-down menus. Running the Kotlin app involved a couple of additional steps but nothing onerous.
VSCode.dev with GitHub Codespaces
Another approach supported by VSCode.dev is running projects using GitHub Codespaces, a managed cloud hosting environment. Codespaces is a cloud development environment like GitPod. It gives you 60 hours of development time for free and then charges based on the type of VM you are using.
Starting in VSCode.dev, open the Remote Explorer pane on the left of your screen. Select GITHUB CODESPACE and click Create Space:
After another set of permissions, you’ll get access to your repositories in GitHub, as shown in the above screenshot. I select MTyson/iw-java-spring-react from my repository and then the main branch, and then 2 cores with 8 GB of RAM from the options provided.
This causes a new window to launch with a Codespaces version of VS Code. It offers to install a recommended extension for this repository (Extension pack for Java), which I accept. After that, there is a walkthrough to help configure the environment, beginning with installing a JDK.
Fortunately, Codespaces comes with SDKMan already installed so it’s easy to update the Java version from 11 (which is already installed) to Java 21 (which I used for my Spring-React project). From the terminal, I type:
$ sdk install java 21.0.2-open
Once that is completed, I can run the project with:
$ maven spring-boot:run
Much like running the application in VSCode.dev, the Port tab shows the running application and lets us access the UI. We can also manage the running app from Codespaces. When you are ready to shut down Codespaces, head back to the main VSCode.dev page and use the Remote Explorer menu.
Container-based development has some differences from tunneling to the VM, particularly around the lifecycle of the image and its containerized nature. Otherwise, the development experience is similar.
Conclusion
VSCode.dev opens up some new possibilities specific to a browser-based IDE. Beyond the flexibility of being able to code from anywhere, VSCode.dev can turn any cloud machine into a development platform, and give you full-blown IDE interaction with your projects on the cloud. It also supports multiple developers using the same environment for a collaborative social coding experience.
Overall, VSCode.dev is a great addition to your development toolkit.