Skip to content

Request to add support for .properties files in Java Referenced Libraries #537

Closed

Description

#213 added support for managing the JARs referenced by a Java project by setting a value for java.project.referencedLibraries in VSCode. However, it doesn't seem to be possible to specify other types of files here (e.g. Java properties files). This is an issue for me, as my project comes with a file called local/testconfig.properties that we load on the classpath with the following line in the .classpath file:

	<classpathentry kind="lib" path="local"/>

This works fine when running my code from the command line, however because VSCode does not support loading files like this, it means that all of my Junit tests fail if I try to run them directly within VSCode. Previously, I used Eclipse for Java development, and Eclipse does support specifying a directory on the classpath.

According to a post by Sheng Chen (@jdneo) in microsoft/vscode-java-pack#94 (comment) this seems like a known limitation, so I wanted to register the fact that adding support for loading .properties files would be a major improvement from my perspective.

Activity

  1. fbricon commented on Aug 18, 2021

    @fbricon

    java.project.referencedLibraries is used by projects that are neither Maven/Gradle nor Eclipse projects. i.e. for a simple folder containing java files.
    If your project is a simple Eclipse project, your classpath entry should just work. Can you provide a complete example project so we can reproduce the problem?

  2. jonathanbarnett commented on Aug 27, 2021

    @jonathanbarnett
    Author

    Ah. I think this is a case of me being a muppet. I'd initially added in the java.project.referencedLibraries entry to settings.json to get round an issue where tools.jar wasn't being found in $JAVA_HOME/lib. I hadn't realised that specifying a value here overrides the logic that reads the .classpath file, though I can now see that that makes sense. I've resolved the underlying issue with tools.jar, deleted the java.project.referencedLibraries entry and can now see that VSCode is correctly reading everything from my .classpath file. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions