Skip to content

Cannot even run basic Java (with Gradle) autogenerated project #2392

Closed

Description

@AgainPsychoX

Cannot even run basic Java (with Gradle) autogenerated project.

Environment
  • Operating System: Windows 10
  • JDK version: OpenJDK
java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
  • Visual Studio Code version: 1.66.0
  • Java extension version: v0.22.2
Steps To Reproduce
  1. Install Extension Pack for Java.
  2. Click Create Java Project.
  3. Select Gradle (will ask to install Gradle for Java).
  4. Select project location.
  5. Wait for initialization to finish.
  6. Try to run autogenerated basic project.
Current Result

Cannot use Java with Gradle in VS Code.

image

Logs: https://gist.github.com/AgainPsychoX/c78f9c43df3f65f339e4c89aa48098ea

Terminal:

PS C:\Users\PsychoX\Desktop\Środa\Grafika\Renderer>  c:; cd 'c:\Users\PsychoX\Desktop\Środa\Grafika\Renderer'; & 'C:\Users\PsychoX\.vscode\extensions\redhat.java-1.4.0-win32-x64\jre\17.0.2-win32-x86_64\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:1165' '-XX:+ShowCodeDetailsInExceptionMessages' '@C:\Users\PsychoX\AppData\Local\Temp\cp_a5r05w7gbm9zfjlzvure95lfx.argfile' 'Renderer.App'
Error: Could not find or load main class Renderer.App
Caused by: java.lang.ClassNotFoundException: Renderer.App
Expected Result

I hate Java, so ngl "not working" is expected result for me. Some could argue, it should "just" work - but not in Java world.

Activity

  1. AgainPsychoX commented on Apr 6, 2022

    @AgainPsychoX
    Author

    Also fails when running from "Java Projects" thingy (but different reason, malformed shell command)
    image

    PS C:\Users\PsychoX\Desktop\Środa\Grafika\Renderer> gradle  c:; cd 'c:\Users\PsychoX\Desktop\Środa\Grafika\Renderer'; & 'C:\Users\PsychoX\.vscode\extensions\redhat.java-1.4.0-win32-x64\jre\17.0.2-win32-x86_64\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:3100' '-XX:+ShowCodeDetailsInExceptionMessages' '@C:\Users\PsychoX\AppData\Local\Temp\cp_a5r05w7gbm9zfjlzvure95lfx.argfile' 'Renderer.App'
    Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Project 'c' not found in root project 'Renderer'.
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 38s
    Error: could not open `C:\Users\PsychoX\AppData\Local\Temp\cp_a5r05w7gbm9zfjlzvure95lfx.argfile'
    ``
    
  2. AgainPsychoX commented on Apr 6, 2022

    @AgainPsychoX
    Author

    I can't understand, why isn't it working... The file is compiled into .class. If I decompile it, it had the proper main class. Class paths are set properly (inside file included to args @...; contains -cp "C:\\Users\\PsychoX\\Desktop\\Środa\\Grafika\\Renderer\\app\\bin\\main; ...).

    I tried modifying launch.json but it seems it doesn't have any effect - can't even add more class paths or pass additional arguments.

    When I manually do:

    PS C:\Users\PsychoX\Desktop\Środa\Grafika\Renderer\app\bin\main>  & 'C:\Users\PsychoX\.vscode\extensions\redhat.java-1.4.0-win32-x64\jre\17.0.2-win32-x86_64\bin\java.exe' 'Renderer.App'
    Hello World
    

    It works, so why isn't the built-in stuff working?

  3. testforstephen commented on Apr 6, 2022

    @testforstephen
    Collaborator

    The issue is that your path contains some unicode character Środa, and Java debug extension doesn't handle it well.

    Could you move the issue to https://github.com/microsoft/vscode-java-debug/issues?

  4. AgainPsychoX commented on Apr 6, 2022

    @AgainPsychoX
    Author

    I "love" how Java brands itself as multiplatform and portable, when it can't handle Unicode characters left and right... And not even giving clear error/warning message - even working with GCC warnings is easier to read at this point...

    Also, why does the issue still occur when there were similar issues in the past? https://github.com/microsoft/vscode-java-debug/issues?q=Unicode

    Anyway, thanks for help.

  5. fbricon commented on Apr 6, 2022

    @fbricon
    Collaborator

    @testforstephen you're a contributor to both vscode-java and vscode-java-debug, so please transfer that issue over there. Else just close it here.

  6. testforstephen commented on Apr 6, 2022

    @testforstephen
    Collaborator

    Tracked this issue at microsoft/vscode-java-debug#1149

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions