使用Vim Syntastic来处理Android项目(例如com.myproject.project
)。它不能识别在当前文件之外但在我的项目中声明的类。例如,下面的代码会出现错误:
import com.myproject.project.SomeClass;
...
SomeClass someclass = new SomeClass();
使用Vim Syntastic来处理Android项目(例如com.myproject.project
)。它不能识别在当前文件之外但在我的项目中声明的类。例如,下面的代码会出现错误:
import com.myproject.project.SomeClass;
...
SomeClass someclass = new SomeClass();
看到了这篇文章“如何配置Syntastic以使其适用于Android项目”,可以解决问题:
方法一:
在vim编辑器内执行以下命令:
:SyntasticJavacEditClasspath
然后将以下内容添加到缓冲窗口中
/path-to-your-app/bin/classes
/path-to-your-android-sdk/platforms/android-19/*.jar
方法2:
将以下内容添加到 .vimrc 文件中:
let g:syntastic_java_javac_classpath = "/<path-to-your-app>/bin/classes:/<path-to-your-android-sdk>/platforms/android-19/*.jar"
1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_config_file_enabled = 1
2. Where you edit your vim files, add this to a file named .syntastic_javac_config
let g:syntastic_java_javac_classpath = '/home/davis/progs/princeton-algos/week1/libs/algs4.jar'
方法二 - 无论您在何处编辑类路径,都具有优势。
1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_classpath = "/home/davis/progs/princeton-algos/week1/libs/algs4.jar"
1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_config_file_enabled = 1
2. Edit a java file with vim
3. :SyntasticJavacEditClasspath
When the edit window opens, add the class path without quotes and a newline after each entry the class path. In my case, this is the entry
for the setting includes the current folder as well:
/home/davis/progs/princeton-algos/week1/libs/algs4.jar
.
4 :wq the edit setting window
5. Now the class path is set for syntastic when editing files from that location. If you edit from a new directory, you will need to repeat the process.