Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/carldea/panama4newbies

This is a blog series to explore OpenJDK's Project Panama.
https://github.com/carldea/panama4newbies

java openjdk panama

Last synced: about 17 hours ago
JSON representation

This is a blog series to explore OpenJDK's Project Panama.

Awesome Lists containing this project

README

        

# Panama 4 Newbies

This is a quick intro to OpenJDK's Project Panama.

- Part 1 https://foojay.io/today/project-panama-for-newbies-part-1
- Part 2 https://foojay.io/today/project-panama-for-newbies-part-2
- Part 3 https://foojay.io/today/project-panama-for-newbies-part-3
- Part 4 https://foojay.io/today/project-panama-for-newbies-part-4

## Part 1 - Learning Java Panama and C primitive types
Part 1 is where you'll learn about jextract and Panama APIs to create C primitive type data and use the printf() function from stdio.h.
https://github.com/carldea/panama4newbies/tree/main/part01

## Part 2 - Learning Java Panama and C Pointers and Structs
Part 2 you'll increase your knowledge on using Panama APIs to mimic C Pointers and create structs to hold complex data.
https://github.com/carldea/panama4newbies/tree/main/part02

## Part 3 - Learning Java Panama and C based Third Party Libraries
Part 3 is a chance to use Panama APIs to access third party libraries.
https://github.com/carldea/panama4newbies/tree/main/part03

## Part 4 - Learning Java Panama and C based Callbacks (Function Pointers)
Part 4 is a chance to use Panama APIs to allow C code to talk to Java code.
https://github.com/carldea/panama4newbies/tree/main/part04

## Setting up your IDE
1. Make sure you know where you've downloaded the Panama Early Access Build and directory.
2. Setup environment variables and run the following:
```shell
$ java -version
$ jextract -h
```
3. Change directories to Part01 as a project you'll want to setup as the working directory.
4. Run script to jextract for part 1
```shell
$ ./jextract_HelloWorld.java.sh
```
5. Create/Open an IntelliJ project in that directory.
6. Setup up JDK File -> Project Structure -> Project SDK
Select the downloaded the early access JDK from https://jdk.java.net/panama/

![Panama Builds](https://github.com/carldea/panama4newbies/raw/main/IntelliJ-PanamaJDK.png)

7. In preferences you'll need to add --add-modules jdk.incubator.foreign.

IntelliJ you'll need to do the following:

![Add modules](https://github.com/carldea/panama4newbies/raw/main/IntelliJ-Preferences.png)

8. Ensure that directory `generated/src` is marked as generated sources root.
9. Setup Run configurations and JVM options

![Add JVM Options](https://github.com/carldea/panama4newbies/raw/main/IntelliJ-RunConfiguration.png)