[email protected] ,
April 20, 2001 13:17
You also may want to try using ant as your makeprg as follows:
set makeprg=ant.bat " Use ant as the makefile (remove .bat on *nix machines) you can get ant from reference below.
and setting your errorformat to:
"For ant (http://jakarta.apache.org/ ) the above errorformat has to be modified
"to honour the leading [javac] in front of each javac output line:
:set errorformat=%A%*\s%[javac%\] %f:%l: %m,%Z%*\s%[javac%\] symbol%*\s: %m
Put both of these in your .vimrc, use the :cn and :cp commands and have fun.
Scott
[email protected] ,
June 27, 2001 7:05
Another quick way of getting :make to work with ant is to add the following line to your .vimrc file
makeprg=ant\ -emacs
The -emacs option converts Java formatted error messages to C-like error messages. This way you don't have to mess with the errorformat (efm) string (which I was never able to get to work).
[email protected] ,
July 13, 2001 21:55
Step 2 of the original comment should probably have the spaces escaped with whacks, such as
set makeprg=jikes\ -nowarn\ -Xstdout\ +E\ %
set errorformat=%f:%l:%c:%*\d:%*\d:%*\s%m
It works much better for me that way, anyhow.
[email protected] ,
August 31, 2001 16:25
Oops. Let me revise that. It should've been:
set makeprg=jikes\ -nowarn\ -Xstdout\ +E\ %
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
[email protected] ,
November 12, 2001 21:55
Hmm.. none of the solutions above let you specify a classpath for jikes. I currently have the following in my .vimrc:
set makeprg=jikes\ -nowarn\ -Xstdout\ +E\ -classpath\ $CLASSPATH\ %
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
However, the $CLASSPATH isn't expanded. Is there some trick to this?
thanks,
--Jeff
maxiangjiang@hotmail,
January 8, 2002 10:24
use the following to expand $CLASSPATH
<C-R>=$CLASSPATH<CR>
[email protected] ,
May 31, 2002 21:56
Whenever I try to use jikes it never gets off the ground. I get:
:!jikes -nowarn -Xstdout +E -classpath $CLASSPATH \Java\Blah_Blah\Blah\filename.java > C:\DOCUME~1\Owner\LOCALS~1\TEMP\VIe49.tmp
shell returned 1
Any help would be a Godsend!
Thanks!
thane
[email protected] ,
June 24, 2002 22:52
So what if I want to use javac. I know it is slow :-). What lines would I add to my .vimrc?
[email protected] ,
August 1, 2002 8:22
I'm using "slow" ;) javac too. I have only this in my .vimrc:
linux:
set makeprg=javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
win:
set makeprg=cmd\ /c\ \"cmd\ \/c\ javac\ %\ 2>&1\"
errorformat is the same
It works fine for me.
I hope it helps....
[email protected] ,
September 9, 2002 21:49
How do I add files to my .vimrc?
I am trying to add the javac as well.
[email protected] ,
September 9, 2002 21:51
I mean how to I add LINES to my .vimrc?
[email protected] ,
October 3, 2002 14:02
> how do I add lines to my .vimrc
Open the text file .vimrc with a text editor such as Vim...
[email protected] ,
December 3, 2002 11:40
On the windows machine... the following works
Download stderr from http://www.teaser.fr/~amajorel/stderr/ and add it to your path
set shell=cmd
set makeprg=stderr\ javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
To browse through the errors use
:cl
:cn
:cp
[email protected] ,
February 26, 2003 8:09
I am running Win2K and have the following in my vimrc:
set shell=tcsh
if executable("jikes") || executable("jikes.exe")
let&l;:errorformat='%f:%l:%v:%*\d:%*\d:%*\s%m'
nn<silent><buffer> [1
\:let&l;:mp='jikes -nowarn -d <C-R>=$cp<CR> -Xstdout +E %:t'<CR>
elseif executable("javac") || executable("javac.exe")
let&l;:errorformat='%A%f:%l:%m,%-Z%p^,%-C%.%#'
nn<silent><buffer> [1 :let&l;:mp='javac -d <C-R>=$cp<CR> %:t'<CR>
endif
when I do :make I get:
:!jikes +E aka.java > C:/DOCUM~1/dhazel/LOCALS~1/Temp/VIe31f.tmp 2>&1
shell returned 1
E40: Can't open error file ...
When I look in the temp directory the file is not there. What's wrong?
[email protected] ,
February 26, 2003 9:11
I fat fingered my email address on the last post. Please send replies to this one.
[email protected] ,
March 14, 2003 8:47
Hi.
Is the -quiet option necessary in ant to make it work with this errorformat?
set makeprg=ant
set errorformat=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
I got this errorformat from the documentation in gvim v.6.1 but I cant't get it to work.
I have also tried anything else you sugested here but still...
The version of ant I am using is 1.5.1
do you know if different versions of ant have differencies in the output format?
Thanks
[email protected] ,
April 29, 2003 22:52
I use ant for full builds, but when I am refactoring, and thus compiling small changes frequently, ant is way too slow. When compiling frequently I want to use jikes directly, so I have this in my .vimrc (note that makejhess is simply a script that executes ant with the right command line options for me for me):
nmap <F6> :set makeprg=jikes\ -d\ $JHESS_HOME/build\ -deprecation\ -Xstdout\ +E\ % <cr> :make <cr> :set makeprg=makejhess <cr> :cc <cr>
Thus hitting F6 changes my makeprg to jikes, executes jikes, and then switches makeprg back to ant. It takes less than a second to build my project with jikes. It take roughly 4 seconds to build it with ant, so I get a huge speed up!
lech.ambrzykowski at wp.pl,
May 8, 2003 4:08
Some of you might have had problems setting up SUN's software to work with VIM correctly with WIN32. As far as compilation is concerned, most of the problems have been solved (mentioned above). However, I had problems whenever I tried to create a mapping allowing me to "execute" my new classes. Typing:
java c:\somejavaprojectsdir\MyCompiledClass
would return an error. However, using
java -cp c:\somejavaprojectsdir MyCompiledClass
would be okay.
I realized it was good enough, if I changed the working path of the file. One of the tips I found:
cd %:p:h
So, the final thing was to add something like:
augroup filetypedetect
au BufNewFile,BufRead,BufEnter *.java
\ cd %:p:h |
\ map <F9> :w<CR>:!javac "%"<CR> |
\ map <F6> :!java %:t:r<CR>
augroup END
lech.ambrzykowski at wp.pl,
May 8, 2003 4:30
Safer:
augroup filetypedetect
au BufNewFile,BufRead,BufEnter *.java
\ map <F9> :w<CR>:!javac "%"<CR> |
\ map <F6> :!java -cp %:p:h %:t:r<CR>
augroup END
Anonymous ,
September 20, 2003 9:52
Reading this tips, I've just found out that Windows XP supports redirecting stderr.
Just do:
:set shellpipe=>\ %s\ 2>&1
Then, :make will be expanded to {makeprg} > {errorfile} 2>&1 and you'll see all the output from the make program!
[email protected] ,
September 23, 2003 6:24
Also Win2K supports redirecting stderr. You can use tip for Win Xp.
[email protected] ,
October 15, 2003 21:30
I am a java developer forced to use Windows on occasion and use Vim as my primary editing tool. I use the shell redirection (on Win XP) and the output and quickfix work fine, but what I really miss in the win gui version is the "live" feed as the compile is happening, like you get out of tail -ing the temp output in a Unix system.
Anyone have suggestions?
[email protected] ,
October 23, 2003 19:34
how do I set java's classpath in vim just like batach file in Win2k.
I do it with batch file in ultraEdit while build java file in it ?
I'm a newbie. I don't know how to set envirorment in Win2k.
Thank u in advance!
[email protected] ,
January 20, 2004 12:15
FYI if you are getting an e40 error (remember, ':help e40' to get the vim help):
:!jikes +E aka.java > C:/DOCUM~1/dhazel/LOCALS~1/Temp/VIe31f.tmp 2>&1
shell returned 1
E40: Can't open error file ...
do what the help doc says and check to make sure your mkprg, sh, etc. are all set correctly. This is probably due to a path issue (like to where your shell is).
[email protected] ,
May 21, 2004 11:30
wow some of you guys are really advanced at this java malarchy! Ive just started out and wrote my first program on wordpad but i dont know how to compile it. Can some one give me advice on how to open javac on comand prompt and compile my java code please....