You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Manivannan Palanichamy <ma...@gmail.com> on 2007/08/25 22:41:31 UTC

Tomcat (javac)compilation arguments

Hi,

I need to pass javac (compilation) arguments to tomcat. Just as JAVA_OPTS is
there for jvm arguments, is there any env var/ other ways to pass arguments
to javac of tomcat?

-- 
Manivannan Palanichamy
http://mani.gw.googlepages.com/index.html

RE: Tomcat (javac)compilation arguments

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Brian Munroe [mailto:brian.e.munroe@gmail.com] 
> Subject: Re: Tomcat (javac)compilation arguments
> 
> In the OP, what I found interesting was that the default heap size
> wasn't enough to start Tomcat?  According to SUN, the default is
> around 83 MB for 64-bit JVMs [1].

That's the minimum value for the maximum heap size.  If the JVM detects
that it's running on a server-class machine (any 64-bit system, for
example), it's more complicated:
http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html

> Manivannan mentioned that Tomcat doesn't throw any exceptions,
> it just never starts.  I wouldn't have thought that heap was 
> the problem at that point.

Probably not, but there's precious little real information in the
problem statement.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat (javac)compilation arguments

Posted by Brian Munroe <br...@gmail.com>.
On 8/27/07, Caldarale, Charles R <Ch...@unisys.com> wrote:

>
> I'm really curious about one thing:  if the OP has a 64-bit environment,
> why is he being so stingy with heap space?
>

In the OP, what I found interesting was that the default heap size
wasn't enough to start Tomcat?  According to SUN, the default is
around 83 MB for 64-bit JVMs [1].

Does that make sense?  Manivannan mentioned that Tomcat doesn't throw
any exceptions, it just never starts.  I wouldn't have thought that
heap was the problem at that point.

-- brian

[1] - http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_heap_defaults

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat (javac)compilation arguments

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: Tomcat (javac)compilation arguments
> 
> Though I'm not positive, I'm pretty sure that the JSP compiler within
> Tomcat runs in-process;

That's true by default.  However, there is a fork parameter that can be
set for the JSP servlet to cause compilation in a different process.  I
have no idea how to pass heap size parameters to such a secondary
process.

Also note that Tomcat no longer uses javac to compile translated JSPs
into .class files, unless you specifically configure it to do so.

I'm really curious about one thing:  if the OP has a 64-bit environment,
why is he being so stingy with heap space?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat (javac)compilation arguments

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manivannan,

Manivannan Palanichamy wrote:
> My problem is: I am trying to install java & tomcat on a server (redhat
> linux, 64 bit), which runs on shared memory. I need to limit down java start
> up memory, by passing arguments like $javac -J -Xmx118m & $java -Xmx118m so
> that the virtual machince starts, otherwise it is terminated.

Though I'm not positive, I'm pretty sure that the JSP compiler within
Tomcat runs in-process; that is, it runs in the same memory space that
is used by the Tomcat process itself. So, if you set JAVA_OPTS to
include "-Xmx118m", then you will be limiting the amount of memory
available to the entire JVM, including the JSP compiler.

You can do this by either modifying the startup.sh script (which I don't
recommend), or writing your own startup script that looks like this:

#!/bin/sh

TOMCAT_HOME=...

export JAVA_OPTS='-Xmx118m'

$TOMCAT_HOME/bin/startup.sh

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG0vZH9CaO5/Lv0PARAj6iAJ9GtaIgz2S4E9XzJFlK8DTRWOBRdwCgpIa4
JTaoccIgziaoWZ5uBddaWFw=
=mWzo
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat (javac)compilation arguments

Posted by Brian Munroe <br...@gmail.com>.
On 8/27/07, Manivannan Palanichamy <ma...@gmail.com> wrote:

> My problem is: I am trying to install java & tomcat on a server (redhat
> linux, 64 bit), which runs on shared memory. I need to limit down java start
> up memory, by passing arguments like $javac -J -Xmx118m & $java -Xmx118m so
> that the virtual machince starts, otherwise it is terminated.
>

I understand.

I think what you are looking for is CATALINA_OPTS and/or JAVA_OPTS.
This link below is for Tomcat 4.0, but the concept is still valid.
http://books.google.com/books?id=fYygS5Jf6g4C&pg=PA15&lpg=PA15&dq=catalina_opts&source=web&ots=FKXI_AtgUl&sig=kyodX_5z9g2CSLGk9AEvXcfor7E

also see
http://tomcat.apache.org/faq/memory.html

These are both for the JVM, you will still have to pass javac command
line arguments.

One other thing. -In my environment, I run tomcat instances as
separate users, via the 'su' command.  When I first tried this
technique, I was placing environment variables at the top of the
startup script, but they were being ignored.  I ended up having to
place them in $HOME/.bashrc (for example), which now makes perfect
sense.

I doubt this is the case for you, but I just wanted to point it out,
in case your variables weren't being picked up or something.

-- brian

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat (javac)compilation arguments

Posted by Manivannan Palanichamy <ma...@gmail.com>.
oh!
Then, let me put my question clear first..

My problem is: I am trying to install java & tomcat on a server (redhat
linux, 64 bit), which runs on shared memory. I need to limit down java start
up memory, by passing arguments like $javac -J -Xmx118m & $java -Xmx118m so
that the virtual machince starts, otherwise it is terminated.

So, I assume (yes, assumption only) I need to pass same arguments to tomcat,
so that it can start without any error (I also assume, tomcat uses javac and
java in an indirect way to compile & run). So, can you tell me a way how i
pass those arguments to tomcat's javac & java?

I am not able to start tomcat. it is throwing any exception/error but,
simply the prompt returns.


-- 
Manivannan Palanichamy
http://mani.gw.googlepages.com/index.html



On 8/26/07, Brian Munroe <br...@gmail.com> wrote:
>
> On 8/25/07, Manivannan Palanichamy <ma...@gmail.com>
> wrote:
>
> > I need to pass javac (compilation) arguments to tomcat. Just as
> JAVA_OPTS is
> > there for jvm arguments, is there any env var/ other ways to pass
> arguments
> > to javac of tomcat?
>
> Hum,  'javac of tomcat' - Do you mean the JSP Compiler, or do you
> really mean javac, which is used when say, compiling Servlets?
>
> I am not aware of an environment variable ala JAVA_OPTS.  However, if
> you are using Ant, you can add a <compilearg> as a nested element
> within the <javac> element.
>
> For example:
>
> <javac srcdir="${src.home}"
>     destdir="${build.home}/WEB-INF/classes"
>     debug="${compile.debug}"
>     deprecation="${compile.deprecation}"
>     optimize="${compile.optimize}">
>     <classpath refid="compile.classpath"/>
>
>     <compilerarg value="-Xlint" />
>
> </javac>
>
> If this isn't what you were looking for, please advise.
>
> -- brian
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat (javac)compilation arguments

Posted by Brian Munroe <br...@gmail.com>.
On 8/25/07, Manivannan Palanichamy <ma...@gmail.com> wrote:

> I need to pass javac (compilation) arguments to tomcat. Just as JAVA_OPTS is
> there for jvm arguments, is there any env var/ other ways to pass arguments
> to javac of tomcat?

Hum,  'javac of tomcat' - Do you mean the JSP Compiler, or do you
really mean javac, which is used when say, compiling Servlets?

I am not aware of an environment variable ala JAVA_OPTS.  However, if
you are using Ant, you can add a <compilearg> as a nested element
within the <javac> element.

For example:

<javac srcdir="${src.home}"    	
    destdir="${build.home}/WEB-INF/classes"
    debug="${compile.debug}"
    deprecation="${compile.deprecation}"
    optimize="${compile.optimize}">
    <classpath refid="compile.classpath"/>

    <compilerarg value="-Xlint" />

</javac>

If this isn't what you were looking for, please advise.

-- brian

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org