how-to run javascript on my server

Matthew Seaman m.seaman at
Sat Aug 16 09:15:42 PDT 2003

On Fri, Aug 15, 2003 at 08:33:13PM -0400, David Banning wrote:
> I have some menu server java applets I would like to run on my fbsd server
> but I have no idea where to get started. Some initial inquiries on Google
> have not brought any luck.
> Is there any sites that deal with this, or does anyone have a suggestion?

You appear to have become confused between Java and Javascript.  These
are very different things.  Javascript -- which probably should be
described as ECMAScript nowadays -- is a language superficially
similar to Java but that is interpreted within a web browser.
Unfortunately each different brand of browser has it's own idea of
what ECMAScript should be, and that makes it quite tricky to write a
web page that works reasonably in any browser. See
for an attempt at providing a standard and
for an explanation of what it is.  Javascript is either incorporated
directly into a web page or is served up in a separate file
(traditionally with a .js suffix) referenced from the page in
question.  Or in other words, just slap it into the documents
directory of your webserver alongside the .html files.

Java on the other hand is a recent addition to the C-like language
group which has the distinction of running in a virtual machine.
This, together with the inherent object-orientation of the language
and Sun's fanatical dedication to preserving the language standards
means that *compiled* Java class files can be run unmodified on any
platform that supports Java.

Java is a general purpose language, and standalone Java applications
are certainly available.  However, most people will run into Java in
the contexts of "applets".  This is a mini java application that can
be downloaded via a web browser and run in a limited "sandbox" context
on the local machine.  See for instance for an
interesting selection of mathematics oriented examples.

However, what I suspect you have are the converse of that: java
servlets.  These are mini-applications that run as part of a web
*server*.  These are conceptually similar to other dynamic web
languages, like PHP, ASP or some sorts of embedded mod_perl stuff, but
the scope is larger: as well as the dynamic .jsp pages (which are
internally converted to java code and compiled into Java servlets on
the fly) there are also pre-compiled Java classes of various types.
In order to serve such "webapps" to the net in general, you will need
a Java servlet container.  That's a webserver written in Java with all
the necessary internal wiring to be able to load up the webapp object
structure.  There are several available in ports: the various
jakarta-tomcat versions (www/jakarta-tomcat*)and Jetty (www/jetty).

But wait! There's more.  The webapp servlet stuff corresponds roughly
to the middle (logic) tier of a 3-tier application.  There's an
equivalent setup "Enterprise Java Beans" which (very roughly)
corresponds to the 3rd (data) layer in a 3-tier application -- the
'Java Bean' is often an object abstraction for accessing an underlying
RDBMS, but it's not limited to that.  [The web browser and any
associated Java applets or javascript would form the 1st
(presentation) layer in this concept].  See the java/jboss3 port for a
freely available EJB server -- an alternative to the default J2EE
stuff that Sun supplies, but which isn't actually available on FreeBSD
as far as I know.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list