> For the complete documentation index, see [llms.txt](https://pcj.icm.edu.pl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pcj.icm.edu.pl/examples/hello-world.md).

# Hello World

Calculations start from a special `StartPoint` class. That class contains main method (`public void main()`):

```java
import java.io.IOException;
import org.pcj.*;

public class HelloWorld implements StartPoint {

    public static void main(String[] args) throws IOException {
    String nodesFile  = "nodes.txt";
    PCJ.executionBuilder (PcjExample.class)
                .addNodes(new File("nodes.txt"))
                .start();
    }
    }

    @Override
    public void main() throws Throwable {
                System.out.println("Hello World from PCJ Thread " + PCJ.myId()
                                   + " out of " + PCJ.threadCount() );
            }
}
```

The compilation and execution requires *PCJ-5.0.9.jar* in the path:

`javac -cp .:PCJ.jar HelloWorld.java java -cp .:PCJ-5.0.9.jar HelloWorld`

The expected output is presented below:

`wrz 23, 2016 2:00:22 AM org.pcj.internal.InternalPCJ start INFO: PCJ version 5.0.0.SNAPSHOT-a728f5f built on 2016-09-13 00:58:48.180 CEST. wrz 23, 2016 2:00:22 AM org.pcj.internal.InternalPCJ start INFO: Starting HelloWorld with 4 threads (on 1 node)... Hello World from PCJ Thread 2 out of 4 Hello World from PCJ Thread 0 out of 4 Hello World from PCJ Thread 1 out of 4 Hello World from PCJ Thread 3 out of 4 wrz 23, 2016 2:00:22 AM org.pcj.internal.InternalPCJ start INFO: Completed HelloWorld with 4 threads (on 1 node) after 0h 0m 0s. BUILD SUCCESSFUL (total time: 0 seconds)`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://pcj.icm.edu.pl/examples/hello-world.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
