redhat-developer / redhat-developer/vscode-java

java.home Path Cannot be Relative

Open
#1,070 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement preferences ux
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I need to be able to use a relative path when specifying my jdk because I am making a USB version of visual studio that can be used on any computer. If that USB is in the E: (or any other) drive instead of the regular D: we’d have to manually change the path. The python module was able to use a combination of “..\..\” (Example below) to navigate to the relative location of python.exe. Is there a way to do this for the java.home variable, or an extension that adds this functionality?

In Settings.json:
"java.home": "..\..\..\..\..\..\Java12\jdk-12.0.2", //Doesn’t work
"python.pythonPath": "..\..\..\..\..\..\Python\python.exe", //Works

Environment
  • Operating System: Windows
  • JDK version: 12.0.2
  • Visual Studio Code version: 1.38.1
  • Java extension version: Redhat: 0.49.0; Java Extension Pack: 0.8.0
Steps To Reproduce
  1. Download VS Code Windows ZIP archive into a USB disk
  2. Enable the VS Code portable mode (creating “data” folder) https://code.visualstudio.com/docs/editor/portable
  3. Download the JDK binary into the USB disk
  4. Open the VS Code and install the Java Pack extension, the extensions should appear in the data folder
  5. Try and set Java.home to a relative location to VS Code, however it will never find the jdk unless you specify the entire path
Current Result

It cannot find the jdk without the entire path.

Expected Result

The path should point to the JDK relative to VSCode (or some starting position within vscode)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the java.home setting in Settings.json and compare its handling with python.pythonPath, using the Windows portable-mode reproduction described in the issue. Trace how the Java extension resolves the JDK path and clarify the intended base location for relative paths; done means the USB layout works from different drive letters without an absolute path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.