source: public_html/doc/abcl-lisp-java-integration.html

Last change on this file was 15275, checked in by Mark Evenson, 4 years ago

site: clean up HTML

Start moving all presentation logic into CSS.

Declare documents as polyglot HTML5/XHTML
<https://dev.w3.org/html5/html-polyglot/html-polyglot.htm>.

Strip use SVN $Id$ expansion as this doesn't convey any useful
information to the actual reader of the page.

File size: 3.3 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6<title>Installing armedbear the Java way</title>
7<base href="">
8<link rel="stylesheet"
9  type="text/css"
10  href="abcl-css.css">
11<link rel="stylesheet"
12  type="text/css"
13  href="http://common-lisp.net/project/armedbear/style.css"/>
14</head>
15
16<body>
17<a name="top"></a>
18<div class="header"><h1>armedbear</h1></div>
19
20<a href="http://common-lisp.net/project/armedbear/">home</a>
21
22<div id="welcome">
23<pre>
24C:\temp\abcl\abcl-src-0.12.0\dist>java -jar abcl.jar
25Armed Bear Common Lisp 0.12.0
26Java 1.6.0_05 Sun Microsystems Inc.
27Java HotSpot(TM) Client VM
28Low-level initialization completed in 1.262 seconds.
29Startup completed in 4.556 seconds.
30Type ":help" for a list of available commands.
31CL-USER(1): (list 'welcome 'to 'lisp!)
32(WELCOME TO LISP!)
33CL-USER(2):
34</pre>
35</div>
36<h1>Integrating Lisp into Java</h1>
37
38<p>
39This page describes you can use ABCL to integrate Lisp into a Java application.
40Why is this useful? Well, you get the best of both worlds -- you get the
41power of Java and can call upon the very large number of existing tools and
42programs that have been implemented in Java, and merge this with the incredible
43poower of Lisp. So if you have a useful Lisp application rather you no longer
44need to rewrite it in Java. Simply call the ABCL Lisp interpreter to execute
45its Lisp code.
46</p>
47
48<h2>How to compile your Java-Lisp code</h2>
49<p>
50Your Java code will use the special classes provided by ABCL to allow it to
51access the methods needed to interact with your Lisp code. This means that the
52ABCL JAR file needs to appear in your CLASSPATH. Depending on how you build
53your application will depend on the method you choose to use. The simplest
54method is to use the <tt>-cp</tt> option to the Java compiler. Alternatively
55you can set the <tt>CLASSPATH</tt> environment variable, thus simplifying the
56Java command line. Finally you may set the CLASSPATH in your IDE, or using the
57Ant <tt>&lt;classpath&gt;</tt> tag.  To make this more concrete consider you
58have a Java file called <tt>myapp.java</tt>. Then if you use the <tt>javac</tt>
59command to run the Java compiler, your command may look like this (we are, of
60course, describing a Windows platform):
61</p>
62<pre>
63javac -cp c:\path\to\abcl.jar myapp.java
64</pre>
65<p>
66Of course if you have other elements in your classpath you will have to make
67the path more complex to take this into account. So, for example, if you have
68other JAR files in <tt>c:\apps\java-libs</tt>, and the JAR file
69<tt>c:\3rd-party-apps\lib\special-tools.jar</tt>, the command will have to be
70modified to look like this:
71</p>
72<pre>
73javac -cp c:\path\to\abcl.jar;c:\apps\java-libs;c:\3rd-party-apps\lib\special-tools.jar myapp.java
74</pre>
75<p>
76It is clear from the above that the command is getting more and more complex.
77As you add more classes to the commmand line so it will grow, and perhaps
78exceed the maximum command line length. The general solution to this is to
79take the class path information out of the command and store it in an
80environment variable called <tt>CLASSPATH</tt>:
81</p>
82<pre>
83set CLASSPATH=c:\path\to\abcl.jar;c:\apps\java-libs;c:\3rd-party-apps\lib\special-tools.jar
84javac myapp.java
85</pre>
86<p>
87</p>
88</body>
89</html>
Note: See TracBrowser for help on using the repository browser.