[JAVA] How to read a library from a JAR file with VS Code << How to not use Maven / Gradle >>

A memorandum for when you want to program lightly in Java and want to read the JAR file directly when setting up the build tool is troublesome.

[Update] for VS Code Java Extensions Pack in April 2020 (https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar- files-directly) can now be read without using Maven / Gradle.

Java Extensions Pack Java Extension Pack is an extension for creating, debugging, and testing Java programs with VS Code. Install from here.

Read the JAR file

Find "Referenced Libraries" under "JAVA DEPENDENCIES" in the left tab. Click the + button next to "Referenced Libraries" to add the JAR file.

デモンストレーション

Source: [https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly](https://github. com / microsoft / vscode-java-pack / blob / master / release-notes / v0.9.0.md # work-with-jar-files-directly)

If JAVA DEPENDENCIES and Referenced Libraries are not displayed

I don't know why, but it may not be displayed. Rebooting VS Code itself will usually fix it.

Library settings to load by default

You can set the default by changing java.project.referencedLibraries in settings.json of VS Code.

settings.json


"java.project.referencedLibraries": [
    "library/**/*.jar"
]

Recommended Posts

How to read a library from a JAR file with VS Code << How to not use Maven / Gradle >>
How to open a script file from Ubuntu with VS code
How to make a jar file with no dependencies in Maven
How to create a server executable JAR and WAR with Spring gradle
How to download and run a Jar package directly from the Maven repository with just the command line
Add jar file obtained from Maven to IntelliJ
Connect with VS Code from a Windows client to Docker on another server
[Rails] How to read the XML file uploaded from the screen with Hash type
From creating a Spring Boot project to running an application with VS Code
How to use Gradle
How to jump from Eclipse Java to a SQL file
[Spring] Read a message from a YAML file with MessageSource
How to use Z3 library in Scala with Eclipse
How to display a browser preview in VS Code
How to use JDD library in Scala with Eclipse
How to build Java development environment with VS Code
How to use Maven to place resource files outside the JAR
How to decompile apk file to java source code with MAC
How to use a foreign key with FactoryBot ~ Another solution
How to add another project as Maven library with CircleCI and use it for build
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
A memo to start Java programming with VS Code (2020-04 version)
Convert Excel to Blob with java, save it, read it from DB and output it as a file!
How to use PlantUML with Visual Studio Code (created on October 30, 2020)
How to create a new Gradle + Java + Jar project in Intellij 2016.03
Android: How to deal with "Could not determine java version from '10 .0.1'"
Try to make a cross-platform application with JRuby (jar file generation)
How to read a file and treat it as standard input
Add a time stamp to the JAR file name in Gradle
How to use mssql-tools with alpine
How to make a Maven project
Switch from Eclipse to VS Code
How to interact with a server that does not crash the app
How to run a GIF file from the Linux command line (Ubuntu)
How to SSH into Ubuntu from a terminal with public key authentication
Generate source code from JAR file with JD-GUI of Java Decompiler project
How to read log4j configuration file in Java project summarized in jar file Memo
How to start a Docker container with a volume mounted in a batch file
[Xcode] How to add a README.md file
How to add local jar to maven pom.xml
A memorandum on how to use Eclipse
Create a jar file with the command
How to use BootStrap with Play Framework
[Rails] How to use rails console with docker
How to add jar file in ScalaIDE
How to create a Maven repository for 2020
How to call Swift 5.3 code from Objective-C
[Flutter] How to use C / C ++ from Dart?
How to achieve file download with Feign
How to set JAVA_HOME with Maven appassembler-maven-plugin
[Java] [Maven3] Summary of how to use Maven3
How to publish a library in jCenter
How to achieve file upload with Feign
I want to be able to read a file using refile with administrate [rails6]
How to output jar with main class specified by gradle in Intellij IDEA
How to create an Excel form using a template file with Spring MVC
When I call the file with Class # getResource from the jar file, it becomes Not Found and it is a crappy memorandum
Generate HashMap from XML resource file
Generate source code from JAR file with JD-GUI of Java Decompiler project
[Spring] Read a message from a YAML file with MessageSource
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to get a heapdump from a Docker container
How to dump from database (DB) to seeds file