source: branches/0.22.x/abcl/examples/pure-lisp-to-java/Main.java

Last change on this file was 12908, checked in by vvoutilainen, 14 years ago

Add an example for using a java class with CLASSPATH, invoking java
functions from lisp code and finding the java class automagically
as it's in CLASSPATH.

  • Property svn:keywords set to id
File size: 1.3 KB
Line 
1/*
2 * Main.java
3 *
4 * Copyright (C) 2008 Ville Voutilainen
5 * $Id$
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21
22import org.armedbear.lisp.*;
23
24public class Main
25{
26    /**
27     * This example creates an Interpreter instance, loads our
28     * lisp code from a file and then looks up a function defined
29     * in the loaded lisp file and executes the function.
30     *
31     * The function takes a single parameter and invokes a java method
32     * on the object provided. We provide our Main object as the parameter.
33     *
34     */
35    public static int addTwoNumbers(int a, int b)
36    {
37  return a + b;
38    }
39}
Note: See TracBrowser for help on using the repository browser.