Skip to content

Commit

Permalink
fist init
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspapenhagen committed Feb 9, 2019
1 parent b3e1d54 commit fc450da
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
68 changes: 68 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.papenhagen</groupId>
<artifactId>jniplay</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<!--logging-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>


</dependencies>

<build>

</build>
<profiles>
<profile>
<id>rebuild-headerfile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<property name="runtime_classpath" refid="maven.compile.classpath"/>
<exec executable="javah">
<arg value="-cp"/>
<arg value="${runtime_classpath}"/>
<arg value="-d"/>
<arg value="${project.build.directory}/jni"/>
<arg value="eu.papenhagen.jniplay.MainApp"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
6 changes: 6 additions & 0 deletions src/main/cpp/eu_papenhagen_jniplay_MainApp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "eu_papenhagen_jniplay_MainApp.h"
#include <iostream>

JNIEXPORT void JNICALL Java_eu_papenhagen_jniplay_MainApp_output (JNIEnv *env, jclass cls){
std::cout << "Output form C++" <<std:endl;
}
21 changes: 21 additions & 0 deletions src/main/cpp/eu_papenhagen_jniplay_MainApp.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/main/java/eu/papenhagen/jniplay/MainApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package eu.papenhagen.jniplay;

/**
* playing with JNI
*
* @author jens.papenhagen
*/
public class MainApp {

public static void main(String[] args) {
output();
}

public static native void output();

}

0 comments on commit fc450da

Please sign in to comment.