Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java debugger implementation disscussion #42

Open
richPurba opened this issue Oct 14, 2021 · 4 comments
Open

Java debugger implementation disscussion #42

richPurba opened this issue Oct 14, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@richPurba
Copy link

So this should be straightforward (IMHO).
The implementation has been done by Microsoft, and I think the implementation here could be as straightforward as python for an example.
I want to contribute to this project since this is a great project in my opinion. Let me know if there is any opinion about this initial discussion

@pocco81 pocco81 added the enhancement New feature or request label Oct 14, 2021
@pocco81
Copy link
Owner

pocco81 commented Oct 14, 2021

Hey! I was checking java-debug and it really isn't hard to implement, it's very straightforward as you said.

Feel free to PR it, it'd be awesome!

@pocco81 pocco81 changed the title Java Debugger Disscussion Java debugger implementation disscussion Oct 14, 2021
@ak-seyam
Copy link

ak-seyam commented Dec 5, 2021

Any updates?

@PlatyPew
Copy link

PlatyPew commented Jan 10, 2022

This is what I did to install java-debug, works on macOS and Linux (never tested, but should work, though the JAVA_HOME path might need to be amended)

I couldn't compile it with Java 17, so I had to link it to the home directory of Java 11 JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

function _G.install_javadebug()
    local installation_path = vim.fn.stdpath("data") .. "/dapinstall/"

    if vim.fn.isdirectory(installation_path) == 0 then
        vim.fn.mkdir(installation_path)
    end

    installation_path = installation_path .. "/java-debug"
    vim.fn.mkdir(installation_path)

    local git_url = "https://github.com/microsoft/java-debug"

    vim.fn.system({ "git", "clone", git_url, installation_path })

    vim.cmd(
        "split | terminal cd "
            .. installation_path
            .. " && JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home ./mvnw clean install"
    )
end

function _G.uninstall_javadebug()
    local installation_path = vim.fn.stdpath("data") .. "/dapinstall/java-debug"
    vim.fn.delete(installation_path, "rf")

    print("Java-debug uninstalled")
end

vim.cmd("command! DIInstallJava call v:lua.install_javadebug()")
vim.cmd("command! DIUninstallJava call v:lua.uninstall_javadebug()")

Getting the debugger working with jdtls is a whole different story though as it involves installing the nvim-jdtls plugin, attaching it to the LSP and configuring some initialisation options

@punowo
Copy link

punowo commented Jan 17, 2022

This is what I did to install java-debug, works on macOS and Linux (never tested, but should work, though the JAVA_HOME path might need to be amended)

I couldn't compile it with Java 17, so I had to link it to the home directory of Java 11 JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

Might be a stupid question but why not just get the artifact ? https://search.maven.org/artifact/com.microsoft.java/com.microsoft.java.debug.plugin
https://repo1.maven.org/maven2/com/microsoft/java/com.microsoft.java.debug.plugin/

I basically don't know lua, so I made a local PKGBUILD where I would get the latest version, getting the proper latest version was a pipe hell but it worked. It also seemed to work with java 18 EA.

( In the end I gave up and just installed eclipse-plaform with vrapper on my work laptop but I would like to reach a day when all this works similar to how lsps work on nvim )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants