Running headless eclim without a console window on Windows XP

202 views
Skip to first unread message

Benjamin Fritz

unread,
May 2, 2012, 2:35:41 PM5/2/12
to eclim-user
I'm not sure if there's an easier way (please let me know if there
is), but I came up with the attached Visual Basic script and .bat file
for Windows to launch Vim and a headless eclim server without any GUI
window at all. I thought I'd share in case anyone else is interested
or in case something similar could go into the distribution; it took a
lot of web searching to figure out how to do this. I know next to
nothing about Visual Basic, this was mostly trial and error, so the
code could probably use some work (there's only a few lines of it).

Attached in an encrypted 7-zip archive to bypass email filters.
Password is "password". Obviously you should examine the files before
running them.
headless-eclim.7z

Ben Fritz

unread,
May 2, 2012, 2:45:17 PM5/2/12
to eclim...@googlegroups.com
In case you don't notice, there's a couple of hard-coded project paths in there which you should edit for your system or use environment variables.

Ben Fritz

unread,
May 2, 2012, 5:24:24 PM5/2/12
to eclim...@googlegroups.com
I posted too soon. Don't use these, at least not on your real workspace. Although it SEEMS to load OK, and it SEEMS to work (:PingEclim works correctly, as does ProjectTree) as soon as I try to do code completion it fails and gives me a corrupt workspace. Rather than looking into it further I'm abandoning the idea for now, I've wasted too much time on this already.


On Wednesday, May 2, 2012 1:35:41 PM UTC-5, Ben Fritz wrote:

Eric Van Dewoestine

unread,
May 2, 2012, 5:31:25 PM5/2/12
to eclim...@googlegroups.com
On 2012-05-02 14:24:24, Ben Fritz wrote:
> I posted too soon. Don't use these, at least not on your real workspace.
> Although it SEEMS to load OK, and it SEEMS to work (:PingEclim works
> correctly, as does ProjectTree) as soon as I try to do code completion it
> fails and gives me a corrupt workspace. Rather than looking into it further
> I'm abandoning the idea for now, I've wasted too much time on this already.

Thanks for the update and the warning. I was planning on checking this
out and possibly including it in the eclim distribution, but I'll hold
off until the kinks are worked out ;)

> On Wednesday, May 2, 2012 1:35:41 PM UTC-5, Ben Fritz wrote:
> >
> > I'm not sure if there's an easier way (please let me know if there
> > is), but I came up with the attached Visual Basic script and .bat file
> > for Windows to launch Vim and a headless eclim server without any GUI
> > window at all. I thought I'd share in case anyone else is interested
> > or in case something similar could go into the distribution; it took a
> > lot of web searching to figure out how to do this. I know next to
> > nothing about Visual Basic, this was mostly trial and error, so the
> > code could probably use some work (there's only a few lines of it).
> >
> > Attached in an encrypted 7-zip archive to bypass email filters.
> > Password is "password". Obviously you should examine the files before
> > running them.
> >

--
eric

Ben Fritz

unread,
May 3, 2012, 1:12:08 PM5/3/12
to eclim...@googlegroups.com


On Wednesday, May 2, 2012 4:31:25 PM UTC-5, Eric Van Dewoestine wrote:
On 2012-05-02 14:24:24, Ben Fritz wrote:
> I posted too soon. Don't use these, at least not on your real workspace.
> Although it SEEMS to load OK, and it SEEMS to work (:PingEclim works
> correctly, as does ProjectTree) as soon as I try to do code completion it
> fails and gives me a corrupt workspace. Rather than looking into it further
> I'm abandoning the idea for now, I've wasted too much time on this already.

Thanks for the update and the warning. I was planning on checking this
out and possibly including it in the eclim distribution, but I'll hold
off until the kinks are worked out ;)



So...it turns out the corruption isn't my workspace, it's my Eclipse installation. And it's not caused by my script, it also happens when just running headless eclipse in the "normal" way.

A .bat file with these contents reproduces it:

<code>
@echo off
setlocal

:: Starts headless Eclim daemon and starts Vim in a way that will automatically
:: use it, and shut it down when exiting.
::

set CLASSPATH=

set PATH=%PATH%;"C:\Program Files (x86)\Java\jdk1.6.0_29\jre\bin"
set ECLIPSE_HOME=C:\rw_apps\base_eclipse_372\

call %ECLIPSE_HOME%eclimd
pause
call gvim -c "autocmd VimEnter * EclimEnable" -c "autocmd VimEnter * PingEclim" -c "autocmd VimLeave * silent! ShutdownEclim"

:END
endlocal
echo on
</code>

All I need to do is run the .bat file, load a file inside my project, then :qa in Vim, which automatically issues a :ShutdownEclim command.

Then, when I launch Eclipse, I get this error any time I try to open my workspace:

<error>
Eclipse
An error has occurred. See the log file C:\Project_Files\NGAP\CodeWorkspace\.metadata\.log.
</error>

If I close Eclipse, delete my Eclipse installation, re-install Eclipse, re-install Eclim, I can then open the same workspace in Eclipse with no problems. Trying to launch headless Eclipse again as above reproduces the error again.

I get this same error also when launching eclimd and gvim in a non-scripted fashion, by double-clicking on eclimd.bat in a file browser, waiting for it to load, launching gvim, setting up the ShutdownEclim autocmd, and closing Vim.

Even if I manually use :ShutdownEclim without the autocmd, my installation becomes unable to open my workspace, but a re-install of Eclipse fixes it.

It seems that something about headless eclipse is screwing up my eclipse installation.

Do you want the log mentioned in the error message? I'm certainly not able to extract anything useful out of it, but then, I haven't done any sort of java debugging since my entry-level CS courses back in college.

Ben Fritz

unread,
May 3, 2012, 1:17:03 PM5/3/12
to eclim...@googlegroups.com


On Thursday, May 3, 2012 12:12:08 PM UTC-5, Ben Fritz wrote:


It seems that something about headless eclipse is screwing up my eclipse installation.


I should mention, :PingEclim says this, using a new install of Eclipse/eclim:

eclim   1.7.4.3-g63e2fa7
eclipse 3.7.2

And :version says:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 30 2012 14:21:53)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-514
Compiled by digit...@SPAMdancingpaper.com
Huge version with GUI.  Features included (+) or not (-):

Eric Van Dewoestine

unread,
May 5, 2012, 12:21:35 PM5/5/12
to eclim...@googlegroups.com
How soon after starting eclipse are you triggering the shutdown? I'm
wondering if perhaps some eclipse startup jobs are still running in
the background when you issue the shutdown and perhaps none of the
eclipse shutdown api calls that headless eclimd makes are waiting on
those jobs resulting in them being terminated unexpectedly, leaving
corrupted index files, etc. in your workspace.

Does the problem still occur if you wait for eclipse cpu utilization
to drop for a bit after startup before forcing a shudown?

> Do you want the log mentioned in the error message? I'm certainly not able
> to extract anything useful out of it, but then, I haven't done any sort of
> java debugging since my entry-level CS courses back in college.

It would hurt to have a look at it. Knowing eclipse error messages it
probably won't help but who knows.

--
eric

Benjamin Fritz

unread,
May 7, 2012, 10:42:21 AM5/7/12
to eclim...@googlegroups.com
On Sat, May 5, 2012 at 11:21 AM, Eric Van Dewoestine <erva...@gmail.com> wrote:
>
> How soon after starting eclipse are you triggering the shutdown? I'm
> wondering if perhaps some eclipse startup jobs are still running in
> the background when you issue the shutdown and perhaps none of the
> eclipse shutdown api calls that headless eclimd makes are waiting on
> those jobs resulting in them being terminated unexpectedly, leaving
> corrupted index files, etc. in your workspace.
>
> Does the problem still occur if you wait for eclipse cpu utilization
> to drop for a bit after startup before forcing a shudown?
>

Good questions, it hadn't occurred to me that the timing would affect things.

I tried again:

1. double-click eclimd.bat
2. wait for CPU of eclipse.exe to drop to 00; eclimd console window
displays, at the very bottom:
2012-05-07 09:30:52,031 INFO
[org.eclim.eclipse.AbstractEclimApplication] Loaded plugin
org.eclim.core
3. At 9:33, launch gvim.
4. Run :EclimEnable command (my .vimrc has a VimEnter autocmd which
runs EclimDisable, because a lot of the time I don't already have
Eclipse running when I launch Vim)
5. PingEclim tells me to select my workspace, I do so, and it shows
version information.
6. :ShutdownEclim. Time is now 9:35 and eclipse.exe is still at 00
CPU. Note I am prompted again for workspace.
7. I now get, within Vim, "unable to connect to eclimd (port: 9091) -
connect: No connection could be made because the target machine
actively refused it
8. Exit Vim with :q, time is now 9:38 and there is no eclipse in taskmgr.
9. Launch Eclipse normally. Normally, my workspace automatically
opens. This time, it does not.
10. Eclipse is at 00 CPU in taskmgr. Wait until 9:40 and switch to my
workspace from the File menu.
11. Get the error mentioned (An error has occurred. See the log file).

>> Do you want the log mentioned in the error message? I'm certainly not able
>> to extract anything useful out of it, but then, I haven't done any sort of
>> java debugging since my entry-level CS courses back in college.
>
> It would hurt to have a look at it. Knowing eclipse error messages it
> probably won't help but who knows.
>

Prior to all this, I deleted the log file, so that the log file
contains only events from this session. See attached, I hope it is
useful.
.log

Eric Van Dewoestine

unread,
May 7, 2012, 11:10:37 AM5/7/12
to eclim...@googlegroups.com
Thanks for the detailed steps. I'll try to reproduce the issue as soon
as I get a chance.

--
eric

Eric Van Dewoestine

unread,
May 17, 2012, 6:46:33 PM5/17/12
to eclim...@googlegroups.com
On 2012-05-07 09:42:21, Benjamin Fritz wrote:
I've tried several times to reproduce the issue as you've described
but so far I've been unsuccessful. If I'm not mistaken you've been
using eclim for a while now right? When did this problem start
cropping up? One thing you might try is to download a fresh eclipse
distribution, install eclim against that, and then see if you can
reproduce the problem there with a fresh workspace (preferably with no
other instances of eclipse/eclimd running on any other workspaces). If
you can reproduce the issue that way let me know which eclipse distro
you chose ("for C/C++ Developers", "for Java Developers", "Classic"),
which architecture (32 vs 64) along with what eclim features you
enabled and any other relevant steps and I'll see if I can replicate
the problem.

What version of windows are you on?

--
eric

Benjamin Fritz

unread,
May 18, 2012, 1:40:38 PM5/18/12
to eclim...@googlegroups.com
On Thu, May 17, 2012 at 5:46 PM, Eric Van Dewoestine <erva...@gmail.com> wrote:
>
> I've tried several times to reproduce the issue as you've described
> but so far I've been unsuccessful.

Bummer. Well...maybe you'll want to look into the scripts I attached
at the beginning of this thread, they may be useful for users who
don't get corruption issues from headless eclipse.

> If I'm not mistaken you've been
> using eclim for a while now right? When did this problem start
> cropping up? One thing you might try is to download a fresh eclipse
> distribution, install eclim against that, and then see if you can
> reproduce the problem there with a fresh workspace (preferably with no
> other instances of eclipse/eclimd running on any other workspaces).

This is actually what I did to send you the log file. Since
reproducing the issue made Eclipse no longer able to read any of my
workspaces, I had to re-install Eclipse from a freshly downloaded copy
each time before reproducing. I created a new workspace as well to
test with since initially I thought it was the workspace getting
corrupted.

> If
> you can reproduce the issue that way let me know which eclipse distro
> you chose ("for C/C++ Developers", "for Java Developers", "Classic"),
> which architecture (32 vs 64) along with what eclim features you
> enabled and any other relevant steps and I'll see if I can replicate
> the problem.
>

I downloaded the 32-bit architecture of Eclipse for C/C++ Developers.
My installed software list includes only the Eclipse IDE for C/C++
Developers and an in-house plugin for Eclipse made by my employer
which provides the error parser for our compiler.

> What version of windows are you on?
>

Windows XP 64-bit.

Benjamin Fritz

unread,
May 18, 2012, 1:44:14 PM5/18/12
to eclim...@googlegroups.com
On Fri, May 18, 2012 at 12:40 PM, Benjamin Fritz
<fritzo...@gmail.com> wrote:
>> If
>> you can reproduce the issue that way let me know which eclipse distro
>> you chose ("for C/C++ Developers", "for Java Developers", "Classic"),
>> which architecture (32 vs 64) along with what eclim features you
>> enabled and any other relevant steps and I'll see if I can replicate
>> the problem.
>>
>
> I downloaded the 32-bit architecture of Eclipse for C/C++ Developers.
> My installed software list includes only the Eclipse IDE for C/C++
> Developers and an in-house plugin for Eclipse made by my employer
> which provides the error parser for our compiler.

I forgot, to install Eclim I just used:

C:\eclim-git\eclim>set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_29

C:\eclim-git\eclim>ant -Declipse.home=C:\rw_apps\base_eclipse_372
-Dvim.files=U:\vimfiles

I'm not sure how to check what features installed, I think the above
just lets it automatically pick.

Eric Van Dewoestine

unread,
May 26, 2012, 10:35:39 AM5/26/12
to eclim...@googlegroups.com
I had another go at this with the 32bit Windows version of the C/C++
IDE distribution on my 32bit Windows XP vm with a checkout and build
of eclim at the same version you mentioned in a previous email, but I
still can't replicate the issue.

In the steps you provided previously, you you mention having to choose
a workspace on a few of them which sounds like you have multiple
eclimd instances running. Can you replicate the issue with all
eclimd/eclipse instances stopped except for the one you are testing
with and using a clean empty workspace (preferably at the default
eclipse location of $HOME/workspace). If you can test the issue on
another XP machine altogether that would be ideal. I'd like to reduce
the number of variables between your setup and mine as much as
possible to come up with an easily reproducible case.

Using another fresh eclipse install sans your company's in-house
plugin would be preferable as well since that is yet another variable
which I can't account for.

--
eric
Reply all
Reply to author
Forward
0 new messages