Vim Tips Wiki
Register
Advertisement
Tip 1107 Printable Monobook Previous Next

created January 16, 2006 · complexity intermediate · author peter · version 6.0


When using Vim to write J2ME programs for mobile phones, you may find the following useful in your vimrc:

set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m

map <M-1> :make<CR>:cw5<CR>
" cw5 help you to see the error (from {{help|:cn}})
map <M-2> :!preverify -classpath c:\wtk22\lib\cldcapi10.jar;c:\wtk22\lib\midpapi10.jar -d bin tmpclasses<CR>
" preverify is important before running the WTK emulator.

" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad)
" It's best that the jad is generated by WTK22 such that it
" place it in : c:\wtk22\apps\zhanguo (zhanguo is your project name)
map <M-3> :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad<CR>

cmap %/ <C-R>=expand("%:p:h")."/"<CR>

You need to have path on c:\wtk22\bin (or else you need full path in many places).

SET PATH=c:\wtk22\bin;%PATH%

Need to create two directories, normally created by WTK22 or by hand:

cd c:\wtk22\apps\[project]
mkdir tmpclasses
mkdir bin

Also, you need to start editing in the project path, not the src path. e.g.

cd c:\wtk22\apps\[project]
vim src\MyMidlet.java

Do not go out of the [project] path. If you need to edit another file, do:

:e %/

This will auto expand to the current [editing] directory.

Comments


Advertisement