Compiling Scripts from Command Line

pnutsc command

C:\> pnutsc { -d directory | -o jar_file } { -v } { -main } { -C base_directory } { -prefix name }{ -no_proxy } script_file ...

If -o jar_file is specified, compiled classes are saved in the jar_file. Otherwise, compiled class files are saved in the directory just after -d switch, or current directory if -d is not specified.

-v means verbose mode. Generated class names or class file names are printed.

With -main option, the public static void main() method is defined in the generated code.

The class names of the generated code are determined based on the relative names of script file from the base_directory specified with -C option.

The following two examples do the same thing.

e.g.(1)
C:\> pnutsc -o C:\tmp\test.jar -C C:\pnuts C:\pnuts\lib\adapter.pnut C:\pnuts\lib\classloader.pnut
e.g.(2)
C:\> cd C:\pnuts
C:\> pnutsc -o C:\tmp\test.jar lib\adapter.pnut lib\classloader.pnut
The resulting JAR file includes the following classes.
lib.adapter
lib.classloader

If -no_proxy is specified, generated code does not depend on the pnuts.compiler package, but the code for method calls is not optimized.

If the -prefix name is set, the name is the common prefix of the class names. To make the generated code available from the load() function, -prefix pnuts.precompiled. is needed.

D:\pnuts> pnutsc -o pnuts-precompiled.jar -prefix pnuts.precompiled util/*.pnut lib/*.pnut init.pnut

Back