wsdjeg / SpaceVim-comments

1 stars 0 forks source link

Use Vim as a Java IDE | SpaceVim #2

Open wsdjeg opened 6 years ago

wsdjeg commented 6 years ago

https://spacevim.org/use-vim-as-a-java-ide/

HastyFish commented 5 years ago

how to solution this problem [running] java -cp ".:/home/name/.cache/....." main.java Error: Could not find or load main class main Caused by: java.lang.ClassNotFoundException: main

wsdjeg commented 5 years ago

It seems a issue with javaunite.vim, if you can reproduce this issue, please report bug to spacevim.

tiago-aguiar commented 5 years ago

The checker always shows Error not found Symbol at my classes...

LuisJoseSanchez commented 5 years ago

I can't even execute a simple HelloWorld. This is what I get:

[Running] java -cp ".:/home/luisjose/.cache/vimfiles/repos/github.com/wsdjeg/JavaUnit.vim/bin:" HelloWorld


Error: Could not find or load main class HelloWorld

[Done] exited with code=1 in 0.151742 seconds

wsdjeg commented 5 years ago

you need to save the file. checker layer will compile it.

LuisJoseSanchez commented 5 years ago

Thank you. Now it works. I am used to the "autosave" functionality in Netbeans. It should be a nice improvement for SpaceVim to save the file before compilation if there are changes.

¡Thank you very much for your work! ¡SpaceVim is really cool!

LuisJoseSanchez commented 5 years ago

As shown in this page, configuration layer refers to Eclipse files:

[layers.override_cmd]
    java = [
    "java",
    "-Declipse.application=org.eclipse.jdt.ls.core.id1",
    "-Dosgi.bundles.defaultStartLevel=4",
    "-Declipse.product=org.eclipse.jdt.ls.core.product",
    "-Dlog.protocol=true",
    "-Dlog.level=NONE",
    "-noverify",
    "-Xmx1G",
    "-jar",
    "D:\\dev\\jdt-language-server-latest\\plugins\\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar",
    "-configuration",
    "D:\\dev\\jdt-language-server-latest\\config_win",
    "-data",
    "C:\\Users\\Administrator\\.cache\\javalsp"
    ]

So I supose that I need to install Eclipse. I prefer not to install Eclipse in my computer. Is there an alternative configuration? Thank you.

wsdjeg commented 5 years ago

You just need to download the language server, no need to install eclipse, I do not use it.

LuisJoseSanchez commented 5 years ago

Ok. I manage to download "org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar". I also edit the path to make it accessible. But I can't find "config_linux" neither "javalsp".

johnillo commented 5 years ago

@LuisJoseSanchez, maybe this could help: https://github.com/prabirshrestha/vim-lsp/wiki/Servers-Java

adorogensky commented 5 years ago

Where does .cache/javalsp come from? I'm installing on Linux

Worice commented 4 years ago

I am using SpaceVim as Java IDE, just for fun. While configuring ISP, I found that the following windows based step:

[[layers]]
  name = "lsp"
  filetypes = [
    "java"
  ]
  [layers.override_cmd]
    java = [
    "java",
    "-Declipse.application=org.eclipse.jdt.ls.core.id1",
    "-Dosgi.bundles.defaultStartLevel=4",
    "-Declipse.product=org.eclipse.jdt.ls.core.product",
    "-Dlog.protocol=true",
    "-Dlog.level=NONE",
    "-noverify",
    "-Xmx1G",
    "-jar",
    "D:\\dev\\jdt-language-server-latest\\plugins\\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar",
    "-configuration",
    "D:\\dev\\jdt-language-server-latest\\config_win",
    "-data",
    "C:\\Users\\Administrator\\.cache\\javalsp"
    ]

How do I translate it on linux? Aside for the flag config_linux, I clearly cannot find D:\\..., C:\\... equivalency in my system, nor a folder such as jdt-language-server-latest. From Eclipse dedicated page, I am not able to deduce relevant information. Maybe because of my lack of experience. Thanks in advance for any hint, and keep up with the great work!

bmeyer0127 commented 4 years ago

All I want is to be about to type "sout" + tab to get System.out.println(); I suppose that is what what is mentioned as 'code completion'?

alexware69 commented 4 years ago

Did you find a solution for this problem?

how to solution this problem [running] java -cp ".:/home/name/.cache/....." main.java Error: Could not find or load main class main Caused by: java.lang.ClassNotFoundException: main

H-111-di commented 4 years ago

I downloaded the lsp files and place it in the "RTE" folder and set up the spacevim like this:

#Enable Java relevant layers
[[layers]]
  name = "lang#java"

[[layers]]
  name = "lsp"
  filetypes = [
  ┊ "java"
  ]
  [layers.override_cmd]
  ┊ java = [
  ┊ "java",
  ┊ "-Declipse.application=org.eclipse.jdt.ls.core.id1",
  ┊ "-Dosgi.bundles.defaultStartLevel=4",
  ┊ "-Declipse.product=org.eclipse.jdt.ls.core.product",
  ┊ "-Dlog.protocol=true",
  ┊ "-Dlog.level=ALL",
  ┊ "-noverify",
  ┊ "-Xmx1G",
  ┊ "-jar",
  ┊ "~/RTE/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1200.v20200508-1552.jar",
  ┊ "-configuration",
  ┊ "~/RTE/config_linux",
  ┊ "-data"
  ┊ ]

But after this, I can't enable the lsp in the neovim... When I enter "space + l", nothing showed up.

Thanks a lot if anybody can help me or give me any kind of hints...

54cr4m3n70 commented 4 years ago

why not coc-java?

ENate commented 4 years ago

For Java on Spacevim:

# Java
[[layers]]
  name = "lang#java"

[[layers]]
  name = "lsp"
  filetypes = [
    "java"
  ]
  [layers.override_cmd]
    java = [

"java",
    "-Declipse.application=org.eclipse.jdt.ls.core.id1",
    "-Dosgi.bundles.defaultStartLevel=4",
    "-Declipse.product=org.eclipse.jdt.ls.core.product",
    "-Dlog.protocol=true",
    "-Dlog.level=NONE",
    "-noverify",
    "-Xmx1G",

"-jar",
    "~/lsp/newlsp/repository/plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar"
        "-configuration",
        "~/lsp/newlsp/repository/config_linux"
        "-data",
        "~/.cache/javalsp"

] 

It is important that you get org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar and ~/lsp/newlsp/repository/config_linux right (Note that versions may differ for the former). Usually both the config_linux and org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar are often available in same main folder (seeing from your snippet)! I used the ones from the latest version of eclipse Java EE. It seems you can get these files from an eclipse.org site or similar. It was a hassle to get it working at first, but when you do, you may never want to use any other IDE (because you get back your CPU/GPU) and enjoy the benefits of Spacevim as a Java IDE. Hope this helps. Note: Make sure you installed the proper version of pyvim (Use the healthcheck command to see your configs on Spacevim/neovim. Check your neovim (Spacevim for neovim) compatibility with Python2 or Python3. Conflicts can occur and cause a bit of headache. I had to uninstall Spacevim, neovim, vim a few times before deciding to configure everything to work using Python 3.6+ only.

Rishikesh01 commented 3 years ago

Did you find a solution for this problem?

how to solution this problem [running] java -cp ".:/home/name/.cache/....." main.java Error: Could not find or load main class main Caused by: java.lang.ClassNotFoundException: main

Did you find the solution

CMOISDEAD commented 2 years ago

Did you find a solution for this problem?

how to solution this problem [running] java -cp ".:/home/name/.cache/....." main.java Error: Could not find or load main class main Caused by: java.lang.ClassNotFoundException: main

Did you find the solution

Did you find the solution?