Nice TWiki > Doc > CodeExamples > HelloWorldNoviceExample TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
/*
From the command line
1) create a directory hello
2) cd into directory hello
3) save this source code as main.nice in directory hello
4) compile the source code
   \hello> nicec --sourcepath=.. -a hello.jar hello
5) run the jar file
   \hello> java -jar hello.jar
*/



void main(String[] args){ 
   println("hello world"); 
}



/* Notes - Compile & Run
The Nice compiler compiles PACKAGES (directories) not files, 
so we must tell the compiler which directory contains the 
package directory (hello) not which directory contains 
the file (main.nice).

   \projects> nicec hello
   OK

   \projects\hello> nicec --sourcepath=.. hello
   OK

   \projects\hello> nicec hello 
   FAILS! the compiler will try to find \projects\hello\hello


Let's make the compiler output to a jar file (hello.jar):

   \projects\hello> nicec --sourcepath=.. -a hello.jar hello
   nice.lang: parsing
   hello: parsing
   hello: typechecking
   hello: generating code
   hello: linking
   hello: writing in archive
   nice.lang: writing in archive


Let's run the program:

   \projects\hello> java -jar hello.jar
   hello world

*/

-- IsaacGouy - 26 Aug 2003

Topic HelloWorldNoviceExample . { Edit | Attach | Ref-By | Printable | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }
Revision r1.4 - 10 Jan 2004 - 15:36 GMT - IsaacGouy
Parents: WebHome > CodeExamples
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.

Doc.HelloWorldNoviceExample moved from Doc.HelloWorldBeginnerExample on 27 Aug 2003 - 16:26 by IsaacGouy - put it back