Nice TWiki > Doc > HelloWorldNoviceExample (r1.1 vs. r1.4) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
 <<O>>  Difference Topic HelloWorldNoviceExample (r1.4 - 10 Jan 2004 - IsaacGouy)
Deleted:
<
<


 <<O>>  Difference Topic HelloWorldNoviceExample (r1.3 - 27 Aug 2003 - IsaacGouy)
Added:
>
>

%META:TOPICMOVED{by="IsaacGouy" date="1062001567" from="Doc.HelloWorldBeginnerExample" to="Doc.HelloWorldNoviceExample"}%


 <<O>>  Difference Topic HelloWorldNoviceExample (r1.2 - 26 Aug 2003 - IsaacGouy)
Changed:
<
<

4) nicec --sourcepath=.. -a hello.jar hello 5) java -jar hello.jar

>
>

4) compile the source code \hello> nicec --sourcepath=.. -a hello.jar hello 5) run the jar file \hello> java -jar hello.jar

Changed:
<
<

\projects\hello> nicec hello \\ FAILS!

>
>

\projects> nicec hello OK

Changed:
<
<

\projects> nicec hello \\ OK

>
>

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

Changed:
<
<

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

>
>

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


 <<O>>  Difference Topic HelloWorldNoviceExample (r1.1 - 26 Aug 2003 - IsaacGouy)
Added:
>
>

%META:TOPICINFO{author="IsaacGouy" date="1061922780" format="1.0" version="1.1"}% %META:TOPICPARENT{name="CodeExamples"}%


/*
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) nicec --sourcepath=.. -a hello.jar hello
5) 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\hello> nicec hello \\ FAILS!

   \projects> nicec hello \\ OK

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


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 . { View | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }
Revision r1.1 - 26 Aug 2003 - 18:33 GMT - IsaacGouy
Revision r1.4 - 10 Jan 2004 - 15:36 GMT - IsaacGouy
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.