Closed SPiCaRiA closed 8 years ago
please use vundle -or neobundle install JC2;
i used vim-plug to install JC2, isn't that available?
do you add this to ~/.vimrc or ~/.gvimrc
what do u mean "this"?
Plug 'artur-shaik/vim-javacomplete2'
simply add this and the previous one
please use these command
mv ~/.vimrc ~/.vimrc.backup
mv ~/.vim ~/.vimback
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
copy this to ~/.vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'artur-shaik/vim-javacomplete2'
call vundle#end()
filetype plugin indent on
java kg.ash.javavi.Javavi
has taken most of CPU when auto completing, even sometimes reach 100+%, do u have any method of improvement?sorry for bothering ;D
you can look at my vimrc
https://github.com/wsdjeg/DotFiles/blob/master/vimrc_neobundle
thanks a lot, but i think it's not the problem with .vimrc, because we ve already tried with an empty .vimrc just now.
i'm wandering if JC2 needs permission to do with files that outside /home?
@rundisR, no, you don't need super user privileges. Not sure what can be a problem.
however i remember it says that JC2 need to write file to /lib?
vim-javacomplete2/lib
oh sorry... i thought it would be /lib
it's weird that i found that my JC2 partly work without sudo, but not all function!
it seems that only method completion is available without sudo
Comparison:
it says -- Omni completion (^O^N^P) Pattern not found
for the non-sudo one (sorry im using the chinese version;D)
// import java|
// List list = new Li|
// list.|
你玩ubuntu 不用vim 用GVIM 我也是醉了
you are using ubuntu,why do not use vim instead of gvim
有gvim用为何不用。。。我又不需要编辑服务器的文件,只是想要一个顺手的编辑器而已。。。
p.s.: 我觉得在github上还是用英文比较礼貌些?毕竟有外国人看不懂
sorry maybe you can try use vim whit the same vimrc
what do u mean "the same vimrc"? i suppose that it can't be the problem with vimrc since we've tried a fresh vimrc
can you chow me the result of gvim and sudo gvim :echo echo $MYVIMRC
both shows
/home/rundis/.vimrc
for
:echo $MYVIMRC
the comfig file of gvim is not ~/.gvimrc ?
javac -version java -version
rundis@TreeDiagram:~$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
rundis@TreeDiagram:~$ javac -version
javac 1.8.0_51
i am using openjdk oracle jdk will broken the dist-upgrade of ubuntu! i think you can try to do these things!
rm -rf ~/.vim/bundle/vim-javacomplete2
cd
vim test
"then the vundle will install the uninstall plugin vim-javacomplete2
:w close the vim
re open vim by vim test
"the vim-javacomplete2 will autocompile on the first time
re open vim by vim Hello.java
then try with c-x c-o
oh i see, there're some problem will compiling JC2:
"Hello.java" 0L, 0C
:!javac -d /home/rundis/.vim/bundle/vim-javacomplete2/libs/javavi/target/classes
-classpath /home/rundis/.vim/bundle/vim-javacomplete2/libs/javavi/target/classe
s:/home/rundis/.vim/bundle/vim-javacomplete2/libs/javaparser.jar: -sourcepath /h
ome/rundis/.vim/bundle/vim-javacomplete2/libs/javavi/src/main/java: -g -nowarn -
target 1.8 -source 1.8 -encoding UTF-8 /home/rundis/.vim/bundle/vim-javacomplete
2/libs/javavi/src/main/java/kg/ash/javavi/Javavi.java
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 it is just a warning
so do i have to recompile as it says with -Xlint:unchecked?
No, you don't need to recompile. It's ok for now.
Can you try to turn on logging, and put content here?
JCdebugEnableLogs
JCdebugGetLogContent
And run this command in console:
java -XshowSettings
JavaComplete_Home: /home/rundis/.vim/bundle/vim-javacomplete2
Default sources: /home/rundis/GitHub/MyCMS/assets/js/custom/IChartjs/src:/home/rundis/Programs/VSCode-linux-x64/resources/app/node_modules/chokidar/node_modules/fsevents/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/AndroidTVActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/BlankActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/BlankActivityWithFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/BlankWearActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/EmptyActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/FullscreenActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/GoogleMapsActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/GooglePlayServicesActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/LoginActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/MasterDetailFlow/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/NavigationDrawerActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/SettingsActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/activities/TabbedActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/BlankActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/BlankActivityWithFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/EmptyActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/FullscreenActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/LoginActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/MasterDetailFlow/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/NavigationDrawerActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/SettingsActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/activities/TabbedActivity/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/AidlFile/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/AppWidget/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/BlankFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/BroadcastReceiver/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/ContentProvider/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/CustomView/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/Daydream/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/IntentService/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/ListFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/Notification/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/PlusOneFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/other/Service/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/eclipse/projects/NewJavaLibrary/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/gradle-projects/NewJavaLibrary/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/AidlFile/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/AppWidget/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/BlankFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/BroadcastReceiver/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/ContentProvider/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/CustomView/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/Daydream/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/DisplayNotification/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/IntentService/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/ListFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/Notification/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/PlusOneFragment/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/Service/root/src:/home/rundis/Programs/idea-IC-141.1532.4/plugins/android/lib/templates/other/WatchFaceService/root/src:/home/rundis/Programs/pycharm-community-4.5.3/lib/src:
Start server
Communicate: -p "java" [s:DoGetInfoByReflection]
Communicate: -p "java" [s:DoGetInfoByReflection]
Communicate: -p "java" [s:DoGetInfoByReflection]
Communicate: -p "java" [s:DoGetInfoByReflection]
Communicate: -p "java" [s:DoGetInfoByReflection]
Communicate: -p "java.util" [s:DoGetInfoByReflection]
Communicate: -p "java.util" [s:DoGetInfoByReflection]
Communicate: -p "java.util" [s:DoGetInfoByReflection]
GetDeclaredClassName for "listy"
F3. "listy.|" typename: ""
F4. "TypeName.|"
DoGetClassInfo: listy
Communicate: -E "listy" [FetchClassInfo in Batch]
Communicate: -E "java.lang.listy" [FetchClassInfo in Batch]
Communicate: -E "java.lang.Object" [FetchClassInfo in Batch]
java.lang.Object
finish completion 0.428111s
GetDeclaredClassName for "list"
F3. "list.|" typename: "List"
DoGetClassInfo: List
Communicate: -E "java.util.List" [FetchClassInfo in Batch]
java.util.List
finish completion 0.180754s
VM settings:
Max. Heap Size (Estimated): 1.72G
Ergonomics Machine Class: server
Using VM: Java HotSpot(TM) 64-Bit Server VM
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = /home/.java/jdk1.8.0_51/lib
.
java.class.version = 52.0
java.endorsed.dirs = /home/rundis/.java/jdk1.8.0_51/jre/lib/endorsed
java.ext.dirs = /home/rundis/.java/jdk1.8.0_51/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /home/rundis/.java/jdk1.8.0_51/jre
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib/amd64
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_51-b16
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_51
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.51-b03
line.separator = \n
os.arch = amd64
os.name = Linux
os.version = 3.19.0-25-generic
path.separator = :
sun.arch.data.model = 64
sun.boot.class.path = /home/rundis/.java/jdk1.8.0_51/jre/lib/resources.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/rt.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/sunrsasign.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/jsse.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/jce.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/charsets.jar
/home/rundis/.java/jdk1.8.0_51/jre/lib/jfr.jar
/home/rundis/.java/jdk1.8.0_51/jre/classes
sun.boot.library.path = /home/rundis/.java/jdk1.8.0_51/jre/lib/amd64
sun.cpu.endian = little
sun.cpu.isalist =
sun.desktop = gnome
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level = unknown
user.country = CN
user.dir = /home/rundis
user.home = /home/rundis
user.language = zh
user.name = rundis
user.timezone =
Locale settings:
default locale = 中文 //Chinese
default display locale = 中文 (中国) //Chinese(China)
default format locale = 中文 (中国) //Chinese(China)
available locales = , ar, ar_AE, ar_BH, ar_DZ, ar_EG, ar_IQ, ar_JO,
ar_KW, ar_LB, ar_LY, ar_MA, ar_OM, ar_QA, ar_SA, ar_SD,
ar_SY, ar_TN, ar_YE, be, be_BY, bg, bg_BG, ca,
ca_ES, cs, cs_CZ, da, da_DK, de, de_AT, de_CH,
de_DE, de_GR, de_LU, el, el_CY, el_GR, en, en_AU,
en_CA, en_GB, en_IE, en_IN, en_MT, en_NZ, en_PH, en_SG,
en_US, en_ZA, es, es_AR, es_BO, es_CL, es_CO, es_CR,
es_CU, es_DO, es_EC, es_ES, es_GT, es_HN, es_MX, es_NI,
es_PA, es_PE, es_PR, es_PY, es_SV, es_US, es_UY, es_VE,
et, et_EE, fi, fi_FI, fr, fr_BE, fr_CA, fr_CH,
fr_FR, fr_LU, ga, ga_IE, hi, hi_IN, hr, hr_HR,
hu, hu_HU, in, in_ID, is, is_IS, it, it_CH,
it_IT, iw, iw_IL, ja, ja_JP, ja_JP_JP_#u-ca-japanese, ko, ko_KR,
lt, lt_LT, lv, lv_LV, mk, mk_MK, ms, ms_MY,
mt, mt_MT, nl, nl_BE, nl_NL, no, no_NO, no_NO_NY,
pl, pl_PL, pt, pt_BR, pt_PT, ro, ro_RO, ru,
ru_RU, sk, sk_SK, sl, sl_SI, sq, sq_AL, sr,
sr_BA, sr_BA_#Latn, sr_CS, sr_ME, sr_ME_#Latn, sr_RS, sr_RS_#Latn, sr__#Latn,
sv, sv_SE, th, th_TH, th_TH_TH_#u-nu-thai, tr, tr_TR, uk,
uk_UA, vi, vi_VN, zh, zh_CN, zh_HK, zh_SG, zh_TW
all in all, the non-sudo mode only work for method name completion
Can you check this directory /home/rundis/.java/jdk1.8.0_51/jre
, can
you read it.
And also can you check your env variable JAVA_HOME
, have you set it,
and if yes, what is there?
I think i know where is the problem! please don't install JDK manually use this command
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
or
sudo apt-get install openjdk-8-jdk
and delete the JAVA_HOME in your ~/.profile or~/.bashrc
@artur-shaik
jre
$JAVA_HOME
shows /home/rundis/.java/jdk1.8.0_51
which exactly my jdk locate@wsdjeg why not manually install JDK? actually i used jenv to install my jdk
By the way, can you check, is java process exist, after you run completion?
@artur-shaik yes, i get java kg.ash.javavi.Javavi
after completion
Ok. Also, can you try run completion after dot in imports.
import java.|
Doesn't it work, too?
@artur-shaik
these are the situation ive tested:
DOESN'T WORK(needs sudo):
import java|
import java.|
List list = new Li|
they all shows -- Omni completion (^O^N^P) Pattern not found
WORK:
list.|
What java
uses your root
user? The same, or it some another?
It's really weird issue.
i think it is a problem of how does he install the JDK!
@rundisR can you try this commands
cd ~/.vim/bundle/vim-javacomplete2
mv -rf libs/javavi/target
cd libs/javavi/
mvn compile
@wsdjeg i reinstalled jdk with
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
but nothing changed i will try this new one
@artur-shaik i'm not sure what u mean, but i only have two user: root and rundis(no sudo privileges)
@artur-shaik
Can you check this directory
/home/rundis/.java/jdk1.8.0_51/jre
, can you read it. And also can you check your env variableJAVA_HOME
, have you set it, and if yes, what is there? translate 检测这个文件夹你是否可读 检测JAVA_HOME环境变量是否设置,如果设置了,指向哪里?
I mean, can you login under root, and run java -XshowSettings
, and
check your JAVA_HOME, under root.
sorry for misunderstanding... something wrong on my ubuntu, ill try to reinstall it this afternoon and try it tomorrow
you can use ubuntu instade of ubuntu kylin
@wsdjeg im not using ubuntu kylin
does the plugin work?
yes, i fianlly finish reinstalling this morning...(the school's network is too slow especially with GFW)
@wsdjeg you are right, its the problem with my jdk
appreciate for your help!! @wsdjeg @artur-shaik
I installed javacomplete2 as well as YouCompleteMe, but my javacomplete2 doesn't work unless i open gVim with sudo privileges:
$ sudo gvim
my .vimrc
autocmd FileType java set omnifunc=javacomplete#Complete
not problem with YCM, ive tried disabling YCM but still need sudo privileges...
why would this happen? im a new vimer, many thx!!