tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: How to compile a servlet for Tomcat 5 on IBM JVM
Date Mon, 22 Dec 2008 00:17:05 GMT
Rainer Jung wrote:

Thanks Rainer.
You gave me more than hope. The tip below already does it.
You just saved my laptop, and Warszaw.

> You compiled with Java 6 and try to run under Java 5. That won't work, 
> unless you add "-target 1.5" to your javac arguments.
I did, and it works. The servlet compiled that way on my laptop runs 
fine on the server, and it even does what I wanted.

It is really a ridiculous little servlet, but considering it is going to 
save installing and running Samba and winbind on 4 servers, it's worth 
its weight in diamonds.

> Unfortunately you didn't tell us, how you called javac on the IBM 
> system. I think it is recommendation number 6. ;)

I didn't because I know you guys love to guess, and I didn't want to 
spoil the fun.

It's a whole process to connect to that server, and when I am connected 
I lose my other connections (email e.g.). Unfortunately I didn't think 
of copying the javac line before disconnecting to write the post, and I 
was too lazy to reconnect.  But now I did, because even if the tip above 
works, I wanted to understand why the compilation didn't before.

It was of course a stupid error in the script, which I copied from my 
laptop and modified for that Linux server, but not quite well enough.

This is the shell script I originally used to try to compile the servlet 
on that server :

$JAVA_HOME/bin/javac -classpath 


And the stupid error was :
on Unix, contrary to Windows, one has to use ":" to separate classpath 
components, instead of ";"

As per your recommendation # 1 I also removed the tools.jar, so the 
final script which works is :

$JAVA_HOME/bin/javac -classpath 
" $1

(javac is one single line)
> Looks like servlet-api.jar is not on your build classpath. Look inside 
> the jar, you can find all the missing classes there.
That was due to the semicolons.

So, you see, if I had copied the javac line in the first post, you guys 
would have spotted that error right away, and I would never have known 
about the "-target 1.5" switch.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message