www.delorie.com/gnu/docs/kawa/kawa_22.html   search  
Buy GNU books!

Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.3 Compiling Scheme to a standalone application

A Java application is a Java class with a special method (whose name is main). The application can be invoked directly by naming it in the Java command. If you want to generate an application from a Scheme program, create a Scheme source file with the definitions you need, plus the top-level actions that you want the application to execute. You can compile in the regular way decribed in the previous section, but add the --main option. For example, assuming your Scheme file is MyProgram.scm:
kawa --main -C MyProgram.scm
This will create a MyProgram.class which you can either load (as decribed in the previous section), or invoke as an application:
java MyProgram [args]
Your Scheme program can access the command-line arguments args by using the global variable `command-line-arguments'.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003