source: public/content/doc/abcl-install-with-java.html

Last change on this file was 12211, checked in by ehuelsmann, 15 years ago

Incorporate remark from John Pallister (prevent UNBOUND-VARIABLE error).

File size: 23.1 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>Installing the Java way</h1>
37
38<p>
39This page describes one way Java programmers can use to build an application.
40In addition to the Java development kit, which is described below, this way
41also uses a tool called Ant. Ant is a program familiar to Java developers. It
42performs the same sort of tasks that make does for C programmers, ie it
43provides a convenient means of managing the compilation and program building
44tasks that a complex application requires.
45</p>
46<p>
47Users of Java IDEs (Integrated Development Environment) such as
48<a href="http://www.eclipse.org/">Eclipse</a> or
49<a href="http://www.netbeans.org/">NetBeans</a> can build the ABCL JAR file
50within these environments. If you are using these tools you will have already
51downloaded the JDK, and these tools already have a version of Ant installed.
52See the documentation for these tools if you wish to use these to build the
53ABCL JAR file.
54</p>
55<p>
56To install ABCL from the source code as described on this page you need:
57</p>
58<ul>
59  <li>the Java runtime system, which will probably already be installed
60  on your machine;
61  </li>
62  <li>the <a href="abcl-pbdoc.html#jdk">Java development kit</a>, which
63  you have to download from Sun;
64  </li>
65  <li>and the <a href="abcl-pbdoc.html#ant">Ant</a> build tool for Java.
66  </li>
67</ul>
68
69<p>
70Once you have these pre-requisites sorted, you can then go ahead and
71<a href="#abcl">build ABCL</a>. If you wish to use Linux there are
72<a href="#linux">further steps</a> to perform.
73</p>
74<h2>The Java Runtime (JRE)</h2>
75
76<p>
77ABCL needs at least Java 1.5. How do you know if you have this or not? Well,
78for Windows users the quickest way to find out is to open a new command window
79(click <i>Start</i>, then <i>Run</i>, type <tt>cmd</tt> and click <i>OK</i>).
80At the command prompt type <tt>java -version</tt>. If you have the
81<tt>Java.exe</tt> executable in your path you will see output similar to this:
82
83<pre>
84C:\>java -version
85java version "1.6.0_11"
86Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
87Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
88</pre>
89
90<p>
91This will work because it is a version later than Java 1.5. However, if you get
92this response:
93</p>
94<pre>
95'java' is not recognized as an internal or external command,
96operable program or batch file.
97</pre>
98<p>
99It means one of two things, either you don't have Java installed, or if you do
100it is not on your path. To check which one it is type:
101</p>
102
103<pre>
104dir /s c:\java.exe
105</pre>
106<p>
107This command may take a long time to run, as it is doing a search of your hard
108drive, which may be large and have many files. (Of course you can, if you
109prefer, use the Windows search tool: <i>Start</i> -- <i>Search</i>.) A typical
110response may be:
111</p>
112<pre>
113C:\>dir /s \java.exe
114Volume in drive C is Windows
115Volume Serial Number is 7DDF-ABBD
116       
117 Directory of C:\Program Files\Java\jre1.5.0_13\bin
118
11925/09/2007  19:26            49,248 java.exe
120               1 File(s)         49,248 bytes
121
122 Directory of C:\Program Files\Java\jre1.6.0_03\bin
123
12424/09/2007  21:30           135,168 java.exe
125               1 File(s)        135,168 bytes
126
127 Directory of C:\Program Files\Java\jre1.6.0_05\bin
128
12922/02/2008  00:23           135,168 java.exe
130               1 File(s)        135,168 bytes
131</pre>
132<p>
133<img class="java-image" src="javajre.jpg">
134If you don't get any results then you don't have the Java runtime system
135installed. To install it go to <a href="http://java.com">java.com</a>, and
136click the big blue button that is on that page (it's not subtle, as you
137can see from the image at right!). Be aware that Java downloads are quite
138large, so if you need to install or upgrade your version of Java you should
139do this when you have access to decent Internet bandwidth.
140</p>
141<p>
142Your download will be an executable file. When you click the button there
143are full details on how to download and install the software on to your
144computer.
145</p>
146<p>
147The runtime system includes everything that you need to run a Java program.
148This means it has the core executables (eg <tt>java.exe</tt>), as well as
149all the supporting library files needed to make Java work with your
150particular operating system. However downloading the JRE alone is not
151enough...
152</p>
153<a href="#top">top</a>
154
155<a name="jdk"></a>
156<h2>The Java Development Kit (JDK)</h2>
157
158<p>
159The JDK is a different beast to the runtime environment (JRE). You need the
160JRE to actually execute Java code, and without it nothing will work. But if
161you want to go further and write your own Java programs, or compile Java
162code written by others, as we do here, then you will need more than the JRE
163-- you will need the Java development kit. The JDK gives you the basic
164tools to compile Java source code. How do you know if you have the JDK
165installed? Well again arguably the quickest way is to just search your hard
166drive for <tt>javac.exe</tt> (javac is the java compiler). If you get no
167response you don't have the JDK installed.
168</p>
169<p>
170As with the JRE the JDK is available for free from Sun. To download the
171<img class="java-image" src="javajdk.jpg">
172version you are interested in go to the Sun
173website, <a href="http://java.sun.com">java.sun.com</a>, click on the <i>Java
174SE</i> link to the right and then choose the JDK. Alternatively you can use
175their search form -- just enter "JDK". Java comes in various 'flavours': the
176SE is the Standard Edition, and is the one you want; the others are EE, which
177is the Enterprise Edition, and is used for creating web-based solutions using
178Java Bean and Servlet technologies; and ME is the Micro Edition, used to run
179Java on small devices such as phones and PDAs. [Now how cool would it be to
180have Lisp on your phone? There's a thought!]
181</p>
182
183<p>
184Make sure you download the JDK, not the JRE (unless of course you want to
185upgrade your current JRE to a different version). Sun offers the JDK with some
186of its other tools, such as NetBeans. NetBeans is an integrated development
187environment (IDE), which lets you edit your code in a window, and then run it,
188debug it, and manage your applications all within one package. There is a
189learning curve to NetBeans; it is a great IDE, but if you just want to get ABCL
190running you don't need all its bells and whistles.
191</p>
192<p>
193The JDK is even bigger than the JRE. For example, JDK 6 Update 12 is 73MB.
194Installation of the JDK follows the same process as for the JRE: save the
195executable to disk and then execute it. This does take quite some time, so
196please be patient.
197</p>
198<a href= "#top">top</a>
199
200<a name="ant"></a>
201<h2>Ant -- the Java build tool</h2>
202
203<p>
204Ant is an open source project managed by the Apache organisation, that is
205used to manage the compilation and building of larger Java projects. It's home
206<img class="java-image" src="ant-apache-org.jpg">
207page is at <a href="http://ant.apache.org">ant.apache.org</a>. To download
208this tool go to their <a href="http://ant.apache.org/bindownload.cgi">
209download</a> page. Choose the appropriate package for your platform (for
210example Windows users will select the zip archive). Extract the files from
211the package. Windows users can either user the built in feature of Windows
212explorer: double click on the zip file; in the window that pops up click
213<i>File</i> then <i>Extract All</i> (the fastest way to start Explorer:
214right-click on the <i>Start</i> button and click <i>Explore</i>).
215</p>
216<p>
217If you are on a Unix platform you can use <tt>tar</tt> to extract the files.
218As the package is a tar.gz file you can use the <tt>z</tt> option to tar to
219uncompress the archive, before extracting it. This command will both
220uncompress and extract the archive in one go (assuming, of course, that your
221archive is the 1.7.1 version of ant):
222</p>
223
224<pre>
225tar zxvf apache-ant-1.7.1-bin.tar.gz
226</pre>
227
228<p>
229The <a href="http://ant.apache.org/manual/index.html">installation
230instructions</a> are on the ant website. You should read through those to
231understand what needs to be done. The description below shows how these
232were applied when installing Ant on a Windows sytem. The first action that is
233required is to add the Ant bin directory to your system path. From a
234command prompt you can type the following commands. The first modifies the
235path variable, so the bin directory is visible from anywhere. The second
236command executes the <tt>ant</tt> executable.
237</p>
238
239<pre>
240C:\temp\ant\apache-ant-1.7.1>PATH=%PATH%;C:\temp\ant\apache-ant-1.7.1\bin
241
242C:\temp\ant\apache-ant-1.7.1>ant
243Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.6.0_05\lib\tools.jar
244Buildfile: build.xml does not exist!
245Build failed
246C:\temp\ant\apache-ant-1.7.1>
247</pre>
248
249<p>
250Opps! No <tt>tool.jar</tt> file. Obviously this is part of the JDK, and
251so a quick search shows where it is. We can then set the <tt>JAVA_HOME</tt>
252and <tt>ANT_HOME</tt> environment variables and try again:
253</p>
254
255<pre>
256C:\temp\ant\apache-ant-1.7.1>dir \tools.jar /s
257 Volume in drive C has no label.
258 Volume Serial Number is 7DDF-ABBD
259 Directory of C:\Program Files\Java\jdk1.6.0_03\lib
260
26125/09/2007  00:11        12,171,847 tools.jar
262               1 File(s)     12,171,847 bytes
263
264     Total Files Listed:
265               3 File(s)     21,523,154 bytes
266               0 Dir(s)  11,194,011,648 bytes free
267
268C:\temp\ant\apache-ant-1.7.1>set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_03
269
270C:\temp\ant\apache-ant-1.7.1>set ANT_HOME=C:\temp\ant\apache-ant-1.7.1
271
272C:\temp\ant\apache-ant-1.7.1>ant
273Buildfile: build.xml does not exist!
274Build failed
275C:\temp\ant\apache-ant-1.7.1>ant -version
276Apache Ant version 1.7.1 compiled on June 27 2008
277C:\temp\ant\apache-ant-1.7.1>
278</pre>
279
280<p>
281Success, my build failed! (How oxymoronic is that?) Note that these changes are
282only temporary. When you exit out of the command line shell you will lose
283these settings. To preserve them for future shell sessions do this:
284</p>
285
286<ul>
287  <li>Click <i>Start</i> -- <i>Control Panel</i>;
288  </li>
289  <li>Double click the <i>System</i> item, and click on the
290  <i>Advanced</i> tab;
291  </li>
292  <li>Click the <i>Environment Variables</i> button;
293  </li>
294  <li>Find the <tt>PATH</tt> variable, and click <i>Edit</i>.
295  Move to the end of the path (click in the lower box and press
296  end), and add a semi-colon (<tt>;</tt>). Now append the path
297  to the Ant bin directory;
298  </li>
299  <li>Click the <i>New</i> system variable button, and enter the
300  variable name <tt>JAVA_HOME</tt> in the top box, with the
301  appropriate value in the lower box. Then click <i>OK</i>;
302  </li>Do the same again to set the <tt>ANT_HOME</tt> variable;
303  <li>Finally, close all the windows by clicking <i>OK</i>.
304  </li>
305</ul>
306<a href= "#top">top</a>
307
308<a name="abcl"></a>
309<h2>Build ABCL</h2>
310
311<p>
312OK, back to the build process. We are nearly there! You should change to the
313directory where you installed the ABCL source code. Once there you can run
314Ant against the <tt>build.xml</tt> file, which is the file that contains all
315the build instructions Ant needs to create the target Jar file. You specify the
316build file using the <tt>-f</tt> option. By default this file shows you a help
317message on how to use it:
318</p>
319
320<pre>
321C:\temp\ant\apache-ant-1.7.1>cd \temp\abcl\abcl-src-0.12.0
322
323C:\temp\abcl\abcl-src-0.12.0>ant -f build.xml
324Buildfile: build.xml
325
326help:
327     [echo] Main Ant targets:
328     [echo]  abcl.compile
329     [echo]    -- compile ABCL to C:\temp\abcl\abcl-src-0.12.0/build/classes
330     [echo]  abcl.jar
331     [echo]    -- create packaged C:\temp\abcl\abcl-src-0.12.0/dist/abcl.jar
332     [echo]  abcl.wrapper
333     [echo]    -- create executable wrapper for ABCL
334     [echo]  abcl.source.zip abcl.source.tar
335     [echo]     -- create source distributions in C:\temp\abcl\abcl-src-0.12.0/dist
336     [echo]  abcl.clean
337     [echo]     -- remove ABCL intermediate files
338     [echo] Corresponding targets for J exist, but currently aren't as well tested.
339     [echo]
340
341BUILD SUCCESSFUL
342Total time: 0 seconds
343C:\temp\abcl\abcl-src-0.12.0>
344</pre>
345
346<p>
347We want to create the JAR (Java ARchive) file. So we specify the <tt>abcl.jar</tt>
348target, hit RETURN, and wait. Note that a large proportion of the output has been
349removed from the listing below:
350</p>
351
352<pre>
353C:\temp\abcl\abcl-src-0.12.0>ant -f build.xml abcl.jar
354Buildfile: build.xml
355
356abcl.pre-compile:
357    [mkdir] Created dir: C:\temp\abcl\abcl-src-0.12.0\build
358    [mkdir] Created dir: C:\temp\abcl\abcl-src-0.12.0\build\classes
359     [echo] java.version: 1.6.0_03
360
361abcl.copy.lisp:
362     [copy] Copying 188 files to C:\temp\abcl\abcl-src-0.12.0\build\classes
363
364abcl.java.warning:
365     [echo] WARNING: Java version 1.6.0_03 not recommended.
366
367abcl.compile.java:
368    [javac] Compiling 257 source files to C:\temp\abcl\abcl-src-0.12.0\build\cla
369sses
370    [javac] Note: Some input files use unchecked or unsafe operations.
371    [javac] Note: Recompile with -Xlint:unchecked for details.
372
373abcl.fasls.uptodate:
374
375abcl.compile.lisp:
376     [java] Armed Bear Common Lisp 0.12.0 (built Mon Feb 23 2009 14:35:46 GMT)
377     [java] Java 1.6.0_03 Sun Microsystems Inc.
378     [java] Java HotSpot(TM) Client VM
379     [java] Low-level initialization completed in 0.731 seconds.
380     [java] Startup completed in 4.597 seconds.
381     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\coerce.lisp ...
382     [java] ; (IN-PACKAGE #:SYSTEM)
383     [java] ; (DECLAIM (FTYPE # ...))
384     [java] ; (DEFUN COERCE-LIST-TO-VECTOR ...)
385     [java] ; (DECLAIM (FTYPE # ...))
386     [java] ; (DEFUN COPY-STRING ...)
387     [java] ; (DEFUN COERCE-ERROR ...)
388     [java] ; (DECLAIM (FTYPE # ...))
389     [java] ; (DEFUN COERCE-OBJECT-TO-AND-TYPE ...)
390     [java] ; (DEFUN COERCE ...)
391     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\coerce.abcl (0.661 seconds)
392     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\open.lisp ...
393     [java] ; (IN-PACKAGE #:SYSTEM)
394     [java] ; (DEFUN UPGRADED-ELEMENT-TYPE-BITS ...)
395     [java] ; (DEFUN UPGRADED-ELEMENT-TYPE ...)
396     [java] ; (DEFUN OPEN ...)
397     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\open.abcl (0.641 seconds)
398     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\dump-form.lisp ...
399     [java] ; (IN-PACKAGE "SYSTEM")
400     [java] ; (DECLAIM (FTYPE # ...))
401     [java] ; (DEFUN DUMP-CONS ...)
402     [java] ; (DECLAIM (FTYPE # ...))
403     [java] ; (DEFUN DUMP-VECTOR ...)
404     [java] ; (DECLAIM (FTYPE # ...))
405
406  ...
407  lots and lots of output here
408  ...
409
410     [java] ; (DEFMACRO WITH-SLOTS ...)
411     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\with-slots.abcl (0.11 seconds)
412     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\with-standard-io-syntax.lisp ...
413     [java] ; (IN-PACKAGE "SYSTEM")
414     [java] ; (DEFUN %WITH-STANDARD-IO-SYNTAX ...)
415     [java] ; (DEFMACRO WITH-STANDARD-IO-SYNTAX ...)
416     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\with-standard-io-syntax.abcl (0.131 seconds)
417     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\with-thread-lock.lisp ...
418     [java] ; (IN-PACKAGE "EXTENSIONS")
419     [java] ; (DEFMACRO WITH-THREAD-LOCK ...)
420     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\with-thread-lock.abcl (0.08 seconds)
421     [java] ; Compiling C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\write-sequence.lisp ...
422     [java] ; (IN-PACKAGE #:SYSTEM)
423     [java] ; (DEFUN WRITE-SEQUENCE ...)
424     [java] ; Wrote C:\temp\abcl\abcl-src-0.12.0\build\classes\org\armedbear\lisp\write-sequence.abcl (0.09 seconds)
425     [java] 283.678 seconds real time
426     [java] 71118074 cons cells
427
428abcl.compile:
429     [echo] Compiled ABCL with java version: 1.6.0_03
430
431abcl.stamp:
432
433abcl.pre-compile:
434     [echo] java.version: 1.6.0_03
435
436abcl.copy.lisp:
437
438abcl.java.warning:
439     [echo] WARNING: Java version 1.6.0_03 not recommended.
440
441abcl.compile.java:
442
443abcl.fasls.uptodate:
444
445abcl.compile.lisp:
446
447abcl.compile:
448     [echo] Compiled ABCL with java version: 1.6.0_03
449
450abcl.stamp.version:
451     [echo] Building ABCL version: 0.12.0
452
453abcl.stamp.hostname:
454     [echo] abcl.hostname: IBM-D396A533B48
455
456abcl.jar:
457      [jar] Building jar: C:\temp\abcl\abcl-src-0.12.0\dist\abcl.jar
458
459BUILD SUCCESSFUL
460Total time: 6 minutes 6 seconds
461C:\temp\abcl\abcl-src-0.12.0>
462</pre>
463<p>
464The last line of output is our target file:
465<tt>C:\temp\abcl\abcl-src-0.12.0\dist\abcl.jar</tt>. This is actually quite an
466intelligent JAR file, as it knows the name of the main Java class to run. This
467means quite a lot of the complexity of actually running the application is
468hidden from the user. So we can run the JAR file from the command line, using
469<tt>java.exe</tt> with only its <tt>-jar</tt> option:
470</p>
471
472<pre>
473C:\temp\abcl\abcl-src-0.12.0>dir C:\temp\abcl\abcl-src-0.12.0\dist\abcl.jar
474 Volume in drive C has no label.
475 Volume Serial Number is 7DDF-ABBD
476
477 Directory of C:\temp\abcl\abcl-src-0.12.0\dist
478
47923/02/2009  14:41         5,634,488 abcl.jar
480               1 File(s)      5,634,488 bytes
481               0 Dir(s)  11,169,034,240 bytes free
482
483C:\temp\abcl\abcl-src-0.12.0>java -jar C:\temp\abcl\abcl-src-0.12.0\dist\abcl.jar
484Armed Bear Common Lisp 0.12.0
485Java 1.6.0_05 Sun Microsystems Inc.
486Java HotSpot(TM) Client VM
487Low-level initialization completed in 2.413 seconds.
488Startup completed in 6.519 seconds.
489Type ":help" for a list of available commands.
490CL-USER(1):
491</pre>
492<p>Winner! We now have a working version of ABCL. Put the JAR file on a memory
493stick or CD and you have your own personal Lisp system available to you where
494ever you are. Now how cool is that?
495</p>
496
497<a name="linux"></a><a href="#top">top</a>
498<h2>Running ABCL on Linux</h2>
499<p>
500Because ABCL is a Java application, it should in theory be possible to run this
501on any computer where the Java Virtual Machine (JVM) is installed. However, if
502you wish to run this on Linux you need to perform the following actions to
503allow ABCL to run correctly. If you just run the JAR file, then you will find
504the arrow keys (ie up, down, left and right) do not function correctly.
505Instead, you get output as shown below (here the keys entered were, in order,
506up, right, down, and left):
507</p>
508
509<pre>
510Armed Bear Common Lisp 0.12.0
511Java 1.6.0 IBM Corporation
512IBM J9 VM
513Low-level initialization completed in 0.718 seconds.
514Startup completed in 2.411 seconds.
515Type ":help" for a list of available commands.
516CL-USER(1): ^[[A^[[C^[[B^[[D
517</pre>
518
519<p>
520Here you can see that you are not getting the correct response. You need to
521get the tool <a href="http://utopia.knoware.nl/~hlub/rlwrap/">rlwrap</a>. To
522use this you need to first install the software. Download the source code, the
523current version of which is in
524<a href="http://utopia.knoware.nl/~hlub/rlwrap/rlwrap-0.30.tar.gz">
525rlwrap-0.30.tar.gz</a>. Extract the contents to your system. For example, if
526you want to extract into <tt>/tmp</tt> save the file to somewhere on your
527system, and then run this command:
528</p>
529
530<pre>
531cd /tmp
532tar zxvf /path/to/rlwrap-0.30.tar.gz
533</pre>
534
535<p>
536In this case it will create the directory <tt>/tmp/rlwrap-0.30.tar.gz</tt>
537To perform the remaining commands you should <tt>su</tt> to root. This will then
538allow you to intall the binary in <tt>/usr/local/bin</tt>. Run the following
539commands as root:
540</p>
541<pre>
542cd /tmp/rlwrap-0.30
543./configure
544make
545make install
546</pre>
547
548
549<p>
550Now we need to create the file <tt>.abcl_completions</tt>. To do this save
551the following Lisp code to a file, say <tt>test.lisp</tt>:
552</p>
553
554<pre>
555(defvar symbols nil)
556
557(do-all-symbols (sym)
558  (let ((package (symbol-package sym)))
559       (cond
560         ((not (fboundp sym)))
561         ((or (eql #.(find-package :cl) package)
562              (eql #.(find-package :extensions) package)
563              (eql #.(find-package :cl-user) package))
564          (pushnew (symbol-name sym) symbols))
565         ((eql #.(find-package :keyword) package)
566          (pushnew (concatenate 'string ":" (symbol-name sym)) symbols))
567         (package
568           (pushnew (concatenate 'string
569                                 (package-name package)
570                                 ":"
571                                 (symbol-name sym))
572                    symbols)))))
573(with-open-file (output #.(concatenate 'string
574                                       (getenv "HOME")
575                                       "/.abcl_completions")
576                        :direction :output :if-exists :overwrite
577                        :if-does-not-exist :create)
578  (format output "~{~(~A~)~%~}" (sort symbols #'string<)))
579(quit))
580</pre>
581
582<p>
583Now create the <tt>.abcl_completions</tt> by running this command:
584</p>
585
586<pre>
587java -jar abcl.jar --load test.lisp
588</pre>
589
590<p>
591The final <tt>(quit)</tt> ensures this Lisp command returns you to the
592command line when it completes. It creates the <tt>.abcl_completions</tt>
593file in your home directory. We still need to do one more thing, before we
594create the <tt>lisp</tt> executable. If you need to know the path to the
595<tt>abcl.jar</tt> file If you don't know what it is you can search for it:
596</p>
597
598<pre>
599find / 2>/dev/null -name abcl.jar
600</pre>
601
602<p>
603If this does not return any names, try replacing <tt>abcl.jar</tt> with
604<tt>abcl\*.jar</tt>, as the JAR file may have a version number included.
605Consider that the filename returned is <tt>/opt/abcl/abcl.jar</tt>, then we will
606need the line <tt>ABCL_JAR=/opt/abcl/abcl.jar</tt> in our script. So bearing
607this in mind, we can now create a script file that we can call
608<tt>/usr/local/bin/lisp</tt>:
609</p>
610
611<pre>
612#!/bin/sh
613ABCL_JAR=/opt/abcl/abcl.jar # Use your own path here.
614JAVA=$(which java)
615ABCL="$JAVA -server -Xrs -cp $ABCL_JAR org.armedbear.lisp.Main"
616if [ $# -eq 0 ]; then
617  exec rlwrap -b "[]()'\" " --remember -c -f ~/.abcl_completions \
618          -H ~/.abcl_history -s 1000000 $ABCL
619else
620  exec $ABCL "$@"
621fi
622</pre>
623
624<p>
625Now when you use this <tt>lisp</tt> command you will get the keystroke behaviour
626you expect.
627</p>
628
629<a href="#top">top</a>
630<a href="http://common-lisp.net/project/armedbear/">home</a>
631</body>
632</html>
Note: See TracBrowser for help on using the repository browser.