-1

I want to make a Java app that uses the Razer Chroma SDK, but the Chroma SDK is in c++

Is there a way I can run c++ code from Java?

I must use Java for what I want to make.

I have almost no experience in c++, but I understand enough to get doing what I need.

EDIT:

This question is slightly different then others, because it is about a specific SDK, not about general c++ libraries. For this library I was able to use a simpler approach then learning to use things like JNI

Keith M
  • 1,199
  • 2
  • 18
  • 38

2 Answers2

1

You probably want to look into using JNI

Blake Yarbrough
  • 2,286
  • 1
  • 20
  • 36
0

The easiest way I found, and then one that doesn't require learning stuff like JNI:

  1. Create a console application with commands that fire off what you need
  2. In Java, launch the console application and redirect it's input and output streams so you can send it commands, and log it's output (see 12013910)
  3. Have a command in the console application that you can pass a PID, and have the console application watch for when it closes, and then it will close itself. (This fixes having the console application not being closed if the Java application crashes and doesn't call the closing method(s))
Community
  • 1
  • 1
Keith M
  • 1,199
  • 2
  • 18
  • 38