File: compilation.xml

package info (click to toggle)
nice 0.9.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,220 kB
  • ctags: 6,894
  • sloc: java: 42,767; xml: 3,508; lisp: 1,079; sh: 736; makefile: 673; cpp: 21; awk: 3
file content (97 lines) | stat: -rw-r--r-- 3,106 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?xml version="1.0" standalone="no"?>
<page>
<title>Compilation instructions</title>
<keywords>compilation, separate compilation, package</keywords>
<description>How to structure Nice programs, compile and run them</description>

<para>
Nice source files are grouped by <emphasis>packages</emphasis>.
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:
</para>

<programlisting>mkdir ~/nice</programlisting>

<para>
Each time you begin writing a new package, just create a directory for it.
For instance, for package <literal>my.program:</literal>
</para>

<programlisting>mkdir -p ~/nice/my/program</programlisting>

<para>
Then you place all the Nice source
files, with <literal>.nice</literal> 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:
</para>

<programlisting>
cd ~/nice
nicec my.program
</programlisting>

<para>
The reason why it is necessary to enter the packages directory 
(<literal>~/nice</literal>)
is that the default path for looking up source packages 
is the current directory. 
It is possible to specify it using <literal>--sourcepath</literal> option.
The previous example is this equivalent to:
<programlisting>nicec --sourcepath=~/nice my.program</programlisting>
</para>

<para>
To get a list of the compiler's command line options, use:
<literal>nicec --help</literal> or <literal>nicec -h</literal>
(GNU style options are used, thanks to package <literal>nice.opt</literal>).
</para>

<para>
If your package has a <literal>void main(String[] args)</literal> 
function definition, then it is executable. 
The compiler accepts the argument <literal>-a program.jar</literal>,
and produces a Jar archive with the given name 
that is appropriate for execution with <literal>java</literal>:
</para>

<programlisting>
nicec -a program.jar my.program
java -jar program.jar
</programlisting>

<para>
The <literal>program.jar</literal> file is self-contained.
It can be run by any simple JVM.
</para>

<para>
If you need to put additional jars on the classpath to run your
program, you cannot use the <literal>java -jar</literal> command,
because it ignores the classpath. You then need to use
<literal>java -classpath "lib1.jar:lib2.jar:program.jar"
my.program.dispatch</literal> (use <literal>;</literal> instead of
<literal>:</literal> on Windows systems).
</para>

<para>
All imported packages are found automatically, and recompiled if necessary.
Nice enjoys separate compilation.
</para>

<para>
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
<literal>nicec</literal> task for the 
<ulink
url="http://ant.apache.org">Ant build system</ulink>. 
The use of Nice with Ant is
<ulink
url="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/NicecAntTaskdef">
documented</ulink> in the Wiki.
</para>

</page>