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:
Each time you begin writing a new package, just create a directory for it.
For instance, for package
mkdir -p ~/nice/my/program
Then you place all the Nice source
.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:
The reason why it is necessary to enter the packages directory
is that the default path for looking up source packages
is the current directory.
It is possible to specify it using
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
(GNU style options are used, thanks to package
If your package has a
void main(String args)
function definition, then it is executable.
The compiler accepts the argument
and produces a Jar archive with the given name
that is appropriate for execution with
nicec -a program.jar my.program
java -jar program.jar
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"
; 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.