How to pass JVM args when using Java command

625 views
Skip to first unread message

Kannan

unread,
Jan 24, 2011, 6:27:27 PM1/24/11
to eclim-user
While running a main class using the Java command, how do I pass
additional JVM args such as Xmx or -Djava.library.path, etc? I usually
issue the command from VI editor as :Java %
Please note that I am not talking about passing JVM args while
starting eclim.

Eric Van Dewoestine

unread,
Jan 25, 2011, 10:22:07 AM1/25/11
to eclim...@googlegroups.com

This is not currently supported, but I've added it to my todo list.

--
eric

Kannan

unread,
Jan 25, 2011, 3:26:52 PM1/25/11
to eclim-user
Eric,
Until this feature is implemented, is there a workaround/hack?

Eric Van Dewoestine

unread,
Jan 25, 2011, 5:13:50 PM1/25/11
to eclim...@googlegroups.com
On 2011-01-25 12:26:52, Kannan wrote:
> Eric,
> Until this feature is implemented, is there a workaround/hack?

Not that I can think of. Implementing support for vmargs shouldn't be
too difficult, so I'll try to get to that sooner rather than later.

--
eric

Kannan Rajah

unread,
Jan 25, 2011, 5:51:47 PM1/25/11
to eclim...@googlegroups.com
For now, I have put the required JVM parameters (env variables) as part of starting eclim itself (in eclimrc) so that the Java command will implicitly pass them to any new JVMs invoked by it. For some reason, just defining the env variables were not sufficient. Its as if the eclipse JVM does consume the system env variables.

--
Kannan


eric

--
You received this message because you are subscribed to the Google Groups "eclim-user" group.
To post to this group, send email to eclim...@googlegroups.com.
To unsubscribe from this group, send email to eclim-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/eclim-user?hl=en.


Eric Van Dewoestine

unread,
Jan 30, 2011, 2:16:14 PM1/30/11
to eclim...@googlegroups.com
On 2011-01-24 15:27:27, Kannan wrote:

I haven't updated the :Java command in vim yet, but I have updated the
eclim server side java command on github to now accept env vars (-e),
system properties (-s), jvm args (-v), the working directory to use
(-w), and additionally a debug option (-d) which prints out the
building of the java task and the final command that will be run.

Here is an example that utilizes all the args (note that the leading
dashes on the values are escaped to prevent the command line parsing
from mistaking values for options):

$ /usr/local/java/eclipse/eclim -command java \
-d \
-w $HOME \
-e FOO=BAR \
-v "\-Xmx256M" "\-XX:MaxPermSize=256m" \
-s "\-Dfoo=bar" \
-p eclim_unit_test_java \
-c org.eclim.test.Test \
-a foo bar

When I get a chance I'll update the vim side's :Java command to expose
these new options.

--
eric

Reply all
Reply to author
Forward
0 new messages