Skip to content

Debugging for Java Visual Studio Code extension does not support class path wildcards #1503

@aubreyyan

Description

@aubreyyan

Class path wildcards are officially an option in Java: https://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

Specifying target/dependency/* as a class path option is common practice and highly suggested as a method of collecting .m2 jars. See https://stackoverflow.com/a/6079820/8652920

Therefore, this functionality should be easily accessible when specifying classpaths in launch.json. This is not the case, however, and asterisks seem to be prematurely escaped.

Environment
  • Operating System: Linux x64
  • JDK version: openjdk version "17.0.12" 2024-07-16
  • Visual Studio Code version: 1.85.2
  • Java extension version: v22.1.1
  • Java Debugger extension version: v0.58.0
Steps To Reproduce
  1. Create a "java" launch configuration (if you're not sure how, ref https://stackoverflow.com/questions/63711388/how-do-i-provide-launch-option-args-to-vscode-java-debugger) with the "classPaths" option specified, and add the path "$project_src/target/dependency/*"
  2. Specify "shortenCommandLine": "none" to see the full command in terminal
  3. Run and debug, and examine the -cp value generated by this extension
  4. You will see target/dependency/\*
Current Result

cd /path/to/maven/project ; /usr/bin/env /usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:45743 -DconfigFile=src/main/resources/properties/config.properties -Dno_system_volume=true -XX:+ShowCodeDetailsInExceptionMessages -cp /path/to/maven/project/target/dependency/\* com.my.project.Main

Expected Result

cd /path/to/maven/project ; /usr/bin/env /usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:45743 -DconfigFile=src/main/resources/properties/config.properties -Dno_system_volume=true -XX:+ShowCodeDetailsInExceptionMessages -cp /path/to/maven/project/target/dependency/* com.my.project.Main

Additional Informations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions