Skip to content

I can't run a Java program in vscode #963

Closed

Description

I can't run a Java program in Visual Studio Code while the same program run throw the terminal. The error that appears is in the photo below.
Schermata 2021-03-09 alle 20 20 33

Environment
  • Operating System: macOS High Sierra 10.13.6
  • JDK version: 15.0.2
  • Visual Studio Code version: 1.54.1
  • Java extension version: 0.13.0
  • Java Debugger extension version: 0.31.0

[attach a sample project reproducing the error]
public class prova {
public static void main(String[] args){
System.out.println("Ciao");
}
}

Current Result

command 'java.debug.runJavaFile' not found

Expected Result

Ciao

Activity

  1. testforstephen commented on Mar 12, 2021

    @testforstephen
    Contributor

    Could you reload the window and try again?

  2. edoolivero commented on Mar 12, 2021

    @edoolivero
    Author

    Could you reload the window and try again?

    Yes, I can but it doesn't work anyway.

  3. testforstephen commented on Mar 15, 2021

    @testforstephen
    Contributor

    Cannot reproduce. No clue what's wrong in your machine.

    Could you share the logs and the reproduce steps?

    F1 -> Java: Open All Log Files

  4. edoolivero commented on Mar 15, 2021

    @edoolivero
    Author

    Cannot reproduce. No clue what's wrong in your machine.

    Could you share the logs and the reproduce steps?

    F1 -> Java: Open All Log Files

    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_ss_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/ss_ws',
    level: 'info',
    timestamp: '2021-03-15 10:56:54.387'
    }
    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/jdt_ws',
    level: 'info',
    timestamp: '2021-03-15 10:56:54.713'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.jpackage\n',
    level: 'info',
    timestamp: '2021-03-15 10:56:54.932'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.jpackage, jdk.incubator.foreign\n',
    level: 'info',
    timestamp: '2021-03-15 10:56:55.009'
    }
    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_ss_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/ss_ws',
    level: 'info',
    timestamp: '2021-03-15 11:14:38.196'
    }
    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/jdt_ws',
    level: 'info',
    timestamp: '2021-03-15 11:14:38.312'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.jpackage\n',
    level: 'info',
    timestamp: '2021-03-15 11:14:38.491'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.jpackage, jdk.incubator.foreign\n',
    level: 'info',
    timestamp: '2021-03-15 11:14:38.733'
    }
    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_ss_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/ss_ws',
    level: 'info',
    timestamp: '2021-03-15 11:15:41.532'
    }
    {
    message: 'Starting Java server with: /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -jar /Users/edoardoolivero/.vscode/extensions/redhat.java-0.76.0/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /Users/edoardoolivero/Library/Application Support/Code/User/globalStorage/redhat.java/0.76.0/config_mac -data /Users/edoardoolivero/Library/Application Support/Code/User/workspaceStorage/29ecf1bc397f02f1cb0be8a4aedf2877/redhat.java/jdt_ws',
    level: 'info',
    timestamp: '2021-03-15 11:15:41.625'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.jpackage\n',
    level: 'info',
    timestamp: '2021-03-15 11:15:41.915'
    }
    {
    message: 'WARNING: Using incubator modules: jdk.incubator.jpackage, jdk.incubator.foreign\n',
    level: 'info',
    timestamp: '2021-03-15 11:15:41.961'
    }

  5. testforstephen commented on Mar 16, 2021

    @testforstephen
    Contributor

    Could you share the logs and the reproduce steps?
    F1 -> Java: Open All Log Files

    Ping again. It should open two logs file: client.log and .log. Could you please share the .log as well?

  6. BeanVortex commented on Apr 4, 2021

    @BeanVortex

    I think you are trying to run program using F6. instead you can install this extention and a menu appears on the top right of vscode. run it using that extention
    https://marketplace.visualstudio.com/items?itemName=azmi.toolbar-extended-menu

  7. testforstephen commented on Sep 23, 2021

    @testforstephen
    Contributor

    Edoardo Olivero (@edoolivero) does this issue still exist in the latest debugger extension?

  8. no-response commented on Dec 15, 2021

    @no-response

    This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions