0

Is there a way to integrate two programming languages into the same project? I am working over an Intel Edison platform and already done part of SQL and connectivity management in C, now I found some nice libraries in Java for the second part of the project. I wonder how this could be done, for example if there is way to run on the Edison two compiled programs concurrently? I'm using Eclipse IOT.

0andriy
  • 4,183
  • 1
  • 24
  • 37
JuanV
  • 13
  • 4
  • 2
    The Edison runs Linux. Thus, it is *always* running multiple programs at once. You can't really write one program in multiple languages though (although you might want to look at "JNI"). Running multiple processes for different tasks though is perfectly normal. After all, your SQL server software, your web server, etc, are all separate programs performing their own separate tasks. The trick is getting them to communicate between each other properly. There's many methods, and they come under the heading of "[IPC](https://en.wikipedia.org/wiki/Inter-process_communication)". – Majenko Feb 23 '16 at 13:54
  • This conversation has been [moved to chat](http://chat.stackexchange.com/rooms/36159/discussion-on-question-by-juanv-how-to-integrate-java-and-c-into-same-project) as it's related to the "on topic"-ness to Arduino. – Avamander Feb 24 '16 at 11:14

3 Answers3

1

In eclipse it is possible to have Java and C into the same project. but don't do it.

It is a bad idea because in eclipse each project is linked to a "build engine" and the build engine is one one one linked to a programming language.
In other words: you can have c and java files in the same project but you can not build c and java files in the same project.

The best way to link your C and java code is at the workspace level or even better at a version control level.

jantje
  • 116
  • 12
1

Split them in independent parts and develop independently. I assume that your main program is written in Java and C is used for some low-level hardware glue. If I am correct, than I advice you to create a library in C, test it (Check is excellent unit test framework for C) and than use JNI to access this library from Java.

0

First of all, I am not familiar with the Intel Edison. However, what about wrapping up the C functionalities using Java JNI? There is a really intuitive tutorial about this.

http://jonisalonen.com/2012/calling-c-from-java-is-easy/

I hope it will be useful!

Lorenzo Addazi
  • 325
  • 3
  • 12