artur-shaik / vim-javacomplete2

DEPRECATED in favor of jc.nvim
Vim License
973 stars 83 forks source link

When open vim get en error? #242

Closed crazy-canux closed 8 years ago

crazy-canux commented 8 years ago

Actual behavior (Required!)

Download and install javacomplate2.

Expected behavior (Required!)

use vim to edit *.java files.

The steps to reproduce actual behavior (Required!)

  1. ... Download and install this plugin in ~/.vim/bundle/
  2. ...Add "autocmd Filetype java setlocal omnifunc=javacomplete#Complete" in ~/.vimrc
  3. ...Trying to edit a file like test.java. But got an error:

shell returned 2 No Javavi library classes found, it means that we couldn't compile it. Do you have JDK8+ installed?

But, I already installed openjdk8. And java -version can prove it.

Environment (Required!)

wsdjeg commented 8 years ago

@crazy-canux can you try :echo javacomplete#server#GetCompiler()

and also try to use :call javacomplete#server#Compile()

crazy-canux commented 8 years ago

Sure,

And got this errors:

javac: directory not found: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes

crazy-canux commented 8 years ago

"test.java" [New File] Error detected while processing function javacomplete#Start..javacomplete#server#Start..javacomplete#server#GetClassPath..139_GetJavaviClassPath..javacomplete#server#Com pile: line 11: E739: Cannot create directory: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target E739: Cannot create directory: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes :!javac -d "/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes" -classpath "/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/c lasses:/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javaparser.jar" -sourcepath "/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/src/main/java" -g - nowarn -target 1.8 -source 1.8 -encoding UTF-8 "/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/src/main/java/kg/ash/javavi/Javavi.java" javac: directory not found: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes Usage: javac use -help for a list of possible options

shell returned 2 No Javavi library classes found, it means that we couldn't compile it. Do you have JDK8+ installed? Press ENTER or type command to continue

wsdjeg commented 8 years ago

But, I already installed openjdk8. And java -version can prove i

javac: directory not found: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes

please do not use vim-javacomplete2-master ,change it to vim-javacomplete2

wsdjeg commented 8 years ago

if you just down load the zip file ,please unzip it

crazy-canux commented 8 years ago

I have lots of plugins in ~/.vim/bundle, and others are working well. Of course I unzip it. mv vim-javacomplete2-master vim-javacomplete2 Still the same error.

wsdjeg commented 8 years ago

can you try with call mkdir('/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/'. join(['target', 'classes'], g:FILE_SEP), "p")

BTW, are you using pathogen?

crazy-canux commented 8 years ago

Yes, I am using pathogen.

How to try with " call mkdir('/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/'. join(['target', 'classes'], g:FILE_SEP), "p")" ?

wsdjeg commented 8 years ago

run in vim .

call mkdir('/home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/'. join(['target', 'classes'], g:FILE_SEP), "p")
crazy-canux commented 8 years ago

E739: Cannot create directory: /home/chengca/.vim/bundle/vim-javacomplete2-master E739: Cannot create directory: /home/chengca/.vim/bundle/vim-javacomplete2-master/libs/javavi/target/classes

wsdjeg commented 8 years ago

it is due to the different file permission; and you can run this command in terminal ,and see the different file permission between them.

ls -l /home/chengca/.vim/bundle
wsdjeg commented 8 years ago

Recommend to use dein.vim to manager your plugins instead of download plugin yourself.

wsdjeg commented 8 years ago
                            *mkdir()* *E739*
mkdir({name} [, {path} [, {prot}]])
        Create directory {name}.
        If {path} is "p" then intermediate directories are created as
        necessary.  Otherwise it must be "".
        If {prot} is given it is used to set the protection bits of
        the new directory.  The default is 0755 (rwxr-xr-x: r/w for
        the user readable for others).  Use 0700 to make it unreadable
        for others.  This is only used for the last part of {name}.
        Thus if you create /tmp/foo/bar then /tmp/foo will be created
        with 0755.
        Example: >
            :call mkdir($HOME . "/tmp/foo/bar", "p", 0700)
<       This function is not available in the |sandbox|.
        Not available on all systems.  To check use: >
            :if exists("*mkdir")
<
crazy-canux commented 8 years ago

No, I didn't see any different.

drwxr-xr-x 4 root root 4096 Aug 8 2015 bufexplorer drwxr-xr-x 5 root root 4096 Aug 8 2015 ctrlp drwxr-xr-x 6 root root 4096 Sep 8 2015 delimitMate-master drwxr-xr-x 5 root root 4096 Jan 3 01:12 emmet-vim-master drwxr-xr-x 9 root root 4096 Nov 19 20:15 jedi-vim-master drwxr-xr-x 3 root root 4096 Aug 8 2015 minibufexpl drwxr-xr-x 3 root root 4096 Aug 8 2015 molokai drwxr-xr-x 4 root root 4096 Aug 8 2015 nerdcommenter drwxr-xr-x 8 root root 4096 Aug 8 2015 nerdtree drwxr-xr-x 7 root root 4096 Dec 19 2013 perlomni.vim-master drwxr-xr-x 10 root root 4096 Aug 26 2015 python-mode-master drwxr-xr-x 4 root root 4096 Mar 5 2013 rainbow_parentheses.vim-master drwxr-xr-x 9 root root 4096 Aug 8 2015 riv drwxr-xr-x 4 root root 4096 Aug 8 2015 surround drwxr-xr-x 7 root root 4096 Dec 3 13:56 syntastic drwxr-xr-x 4 root root 4096 Dec 29 2012 tablify-master drwxr-xr-x 6 root root 4096 May 17 2013 tabular-master drwxr-xr-x 6 root root 4096 Aug 8 2015 tagbar drwxr-xr-x 4 root root 4096 Aug 8 2015 taglist drwxr-xr-x 8 root root 4096 Mar 25 23:47 tern_for_vim-master drwxr-xr-x 5 root root 4096 Mar 10 10:49 tmux.vim-master drwxr-xr-x 14 root root 4096 Dec 9 21:59 ultisnips-master drwxr-xr-x 6 root root 4096 Oct 19 2015 vim-airline-master drwxr-xr-x 3 root root 4096 Jul 26 2015 vim-colorschemes drwxr-xr-x 5 root root 4096 Aug 8 2015 vim-colors-solarized drwxr-xr-x 6 root root 4096 Jan 3 22:39 vim-easymotion-master drwxr-xr-x 4 root root 4096 Dec 1 17:04 vim-fugitive-master drwxr-xr-x 5 root root 4096 Aug 8 2015 vim-gitgutter drwxr-xr-x 6 root root 4096 Oct 26 2015 vim-indent-guides-master drwxr-xr-x 3 root root 4096 Jan 19 2015 vim-instant-markdown-master drwxr-xr-x 4 root root 4096 Jun 24 2015 vim-ipython-master drwxr-xr-x 7 root root 4096 Jan 6 01:38 vim-javacomplete2 drwxr-xr-x 10 root root 4096 Dec 23 17:35 vim-markdown-master drwxr-xr-x 4 root root 4096 Aug 8 2015 vim-nagios drwxr-xr-x 3 root root 4096 Aug 8 2015 vim-pathogen drwxr-xr-x 10 root root 4096 Jan 7 21:29 vim-perl-master drwxr-xr-x 7 root root 4096 Aug 8 2015 vim-puppet drwxr-xr-x 6 root root 4096 Oct 30 2015 vim-rails-master drwxr-xr-x 11 root root 4096 Aug 8 2015 vim-ruby-master drwxr-xr-x 4 root root 4096 Jul 25 2015 vim-trailing-whitespace-master drwxr-xr-x 5 root root 4096 Jan 2 11:55 vim-virtualenv-master drwxr-xr-x 7 root root 4096 Aug 8 2015 vimwiki drwxr-xr-x 7 root root 4096 Nov 5 10:55 Vundle.vim drwxr-xr-x 4 root root 4096 Aug 8 2015 winmanager drwxr-xr-x 8 root root 4096 Feb 5 19:21 YouCompleteMe drwxr-xr-x 6 root root 4096 Jan 13 06:56 zeavim.vim-master

artur-shaik commented 8 years ago

Why root? Not all plugins need write permissions to it directory. JC2 plugin just cannot compile server lib to generate completions, because of your permissions.

crazy-canux commented 8 years ago

Oh my god! Yes, you are right. root didn't work.

@artur-shaik @wsdjeg thanks very much!!!