vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

Can not add additional classpath

Open demanLiu opened this issue 1 year ago • 7 comments
trafficstars

[provide a description of the issue]

Environment
  • Operating System: wsl (Arch)
  • JDK version: 1.8
  • Visual Studio Code version: 1.85.1
  • Java extension version: v1.25.1
  • Java Debugger extension version: v0.55.0
Steps To Reproduce
  1. my launch.json { "type": "java", "name": "Application", "request": "launch", "mainClass": "Application", "projectName": "roc-domestic-web", "shortenCommandLine": "auto", "classPaths": [ "$Auto", "~/workspace/domestic-shopping/roc-domestic-common/target/classes/", ], }

  2. launch command line /usr/bin/env /usr/lib/jvm/java-8-openjdk/jre/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:41833 -cp /tmp/cp_aiaqxn8lxgly17gkhnct4os82.jar Application

Current Result

classpath can't have the classpath that I added

Expected Result

can append my customized classpath

demanLiu avatar Jan 10 '24 06:01 demanLiu

Can you replace "~" with the absolute path?

testforstephen avatar Jan 10 '24 07:01 testforstephen

no , I had tried it , absolute path is the same issue

demanLiu avatar Jan 10 '24 07:01 demanLiu

I know the reason , the classpath is written to MANIFEST.MF when ShortenCommandLine = 'jarmanifest', but I want to add additional classpath alone, like '-cp /tmp/cp_aiaqxn8lxgly17gkhnct4os82.jar;. xxx/', is it supported now?

demanLiu avatar Jan 10 '24 07:01 demanLiu

I want to add additional classpath alone, like '-cp /tmp/cp_aiaqxn8lxgly17gkhnct4os82.jar;. xxx/', is it supported now

Unfortunately, this feature is not supported. When the shortenCommandLine configuration is enabled, it will generate the complete classpath into a temporary file.

If you don't want it to be added to the tmp .jar, you can turn off the shortenCommandLine setting.

testforstephen avatar Jan 10 '24 08:01 testforstephen

If I turn off the shortenCommandLine setting, command line is to long , it can not run

demanLiu avatar Jan 10 '24 08:01 demanLiu

Could you please clarify why the default behavior, where the additional classpath is generated into the temporary .jar file, is not suitable for your needs?

testforstephen avatar Jan 10 '24 08:01 testforstephen

Actually, I hope shortenCommonLine can support classpath file , like idea , image because we have to read resource file in our project, if classpath is a jar, my project could not unzip it

demanLiu avatar Jan 10 '24 09:01 demanLiu