source: public_html/doc/abcl-install-with-java.html

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