Compilation instructions
Nice source files are grouped by packages.
A package is the compilation unit in Nice.
Each package resides in a separate directory.
I suggest you create a root directory for your nice packages:
mkdir ~/nice
Each time you begin writing a new package, just create a directory for it.
For instance, for package my.program:
mkdir -p ~/nice/my/program
Then you place all the Nice source
files, with .nice extension, in that directory. The names of the
files have no importance for the compiler, but they should be meaningful
to you of course.
To compile your new package:
cd ~/nice
nicec my.program
The reason why it is necessary to enter the packages directory
(~/nice )
is that the default path for looking up source packages
is the current directory.
It is possible to specify it using --sourcepath option.
The previous example is this equivalent to:
nicec --sourcepath=~/nice my.program
To get a list of the compiler's command line options, use:
nicec --help or nicec -h
(GNU style options are used, thanks to package nice.opt ).
If your package has a void main(String[] args)
function definition, then it is executable.
The compiler accepts the argument -a program.jar ,
and produces a Jar archive with the given name
that is appropriate for execution with java :
nicec -a program.jar my.program
java -jar program.jar
The program.jar file is self-contained.
It can be run by any simple JVM.
If you need to put additional jars on the classpath to run your
program, you cannot use the java -jar command,
because it ignores the classpath. You then need to use
java -classpath "lib1.jar:lib2.jar:program.jar"
my.program.dispatch (use ; instead of
: on Windows systems).
All imported packages are found automatically, and recompiled if necessary.
Nice enjoys separate compilation.
Instead of starting the compiler in a terminal, you can of course automate
this by using a build system. If you are familiar with make, you can
just invoke the compiler as above in a Makefile. There is also a
nicec task for the
Ant build system.
The use of Nice with Ant is
documented in the Wiki.
|