Skip to content

Automatically add --enable-preview to vmArgs, when necessary #553

Closed

Description

@fbricon

Following on redhat-developer/vscode-java#671, when trying to run Java 12 code using preview features, you need to add the --enable-preview flag in the launch configuration's vmArgs:

{
    "configurations": [
        {
            "type": "java",
            "name": "CodeLens (Launch) - Demo",
            "request": "launch",
            "mainClass": "foo.bar.Demo",
            "projectName": "Demo",
            "vmArgs": "--enable-preview"
        }
    ]
}

This could be done automatically by the vscode-java-debug extension

Activity

  1. testforstephen commented on Apr 1, 2019

    @testforstephen
    Contributor

    This vmArgs is not recognized by Java 8. We need distinguish the JVM version first and determine whether to add this flag.

  2. testforstephen commented on Apr 15, 2019

    @testforstephen
    Contributor

    The fix is detecting the java project settings firstly. if the debugger found the current java project enabled preview compiler flag, then auto add --enable-preview to vmArgs.

    In a word, you don't need manually specify --enable-preview vmArgs in launch.json any more.

  3. jesse996 commented on Apr 22, 2019

    @jesse996

    The fix is detecting the java project settings firstly. if the debugger found the current java project enabled preview compiler flag, then auto add --enable-preview to vmArgs.

    In a word, you don't need manually specify --enable-preview vmArgs in launch.json any more.

    hi,have you update this? I still have this problem,it only works after adding the 'vmArgs'.

  4. testforstephen commented on Apr 23, 2019

    @testforstephen
    Contributor

    szx233 We just released 0.18.0, which should have fixed 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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions