calling C functions in java [duplicate] - java

This question already exists:
Can I use a api written in C with java web service [duplicate]
Closed 9 years ago.
I have a tool kit which is written in C. I want to make a java web service which will use this toolkit. how can I do that. how can I call the functions of this toolkit

If the toolkit gives outputs, can you just take the outputs and pipe them?
If not, I think it'd just be easier to convert it yourself, unless pointers are involved.
Otherwise,
http://java.sun.com/docs/books/jni/html/start.html#769

Related

Using Python Libraries or Codes in My Java Application [duplicate]

This question already has answers here:
Calling Python in Java?
(12 answers)
Closed 3 years ago.
I'm trying to build an OCR desktop application using Java and, to do this, I have to use libraries and functions that were created using the Python programming language, so I want to figure out: how can I use those libraries inside my Java application?
I have already seen Jython, but it is only useful for cases when you want to run Java code in Python; what I want is the other way around (using Python code in Java applications).
I have worked in projects where Python was used for ML (machine learning) tasks and everything else was written in Java.
We separated the execution environments entirely. Instead of mixing Python and Java in some esoteric way, you create independent services (one for Python, one for Java), and then handle inter-process communication via HTTP or messaging or some other mechanism. "Mircoservices" if you will.

Java. How to make a bot [duplicate]

This question already has answers here:
How can a program control another program?
(11 answers)
Closed 8 years ago.
I wonder is possible to make a bot writen in JAVA, which will open some program(program is under windows), click on the button in this program and type some data, check status of this program(login or logout, this is client for online game).
Which JAVA tools I need ? I think that java robot lib is not enough for this.
Thanks in advance.
You cannot do this using JAVA.
JAVA is a language which is loosely coupled with operating systems, so it can only receive mouse/key messages from underlying OS. Among all the tasks you mentioned , it can only start the program by using Runtime.execute.
If you want to implement a software like this ,you should use Visual Studio and use Microsoft technologies.

How to use prolog rules in a java application [duplicate]

This question already has answers here:
Embedded Prolog Interpreter/Compiler for Java
(13 answers)
Closed 8 years ago.
I hope my question is not a duplicate... I have implemented some rules using Prolog. I would like to ask if there is any way to use these rules in a java application. I do not want to implement everything in java from scratch. I would like to embed the code written in Prolog in a java application. Thanks in advance.
There are various ways. But judging from your question you're looking for a quick solution.
JPL (since i notice a lot of people are using SWI nowadays):
http://www.swi-prolog.org/FAQ/Java.html
The GNU Prolog library for Java:
http://www.gnu.org/software/gnuprologjava/
SICtus (It comes with syntax examples, etc so it shouldn't be hard for you to use it quickly)
http://sicstus.sics.se/sicstus/docs/3.7.1/html/sicstus_12.html
tuProlog (Said to be the easiest to use, beginner friendly)
http://www.alice.unibo.it/xwiki/bin/view/Tuprolog/

Is it possible to call Java code from a native application? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to call java function from c++?
Can C++ call Java code?
I have a native application on Linux (i.e. main() is in C++) and I want to reuse some of my Java code.
Can I load JVM libraries and somehow call Java classes?
Thank you!
You can load the JVM in your native application and invoke stuff using the Invocation API

Can i access c++ or Java functions inside python [duplicate]

This question already has answers here:
Calling C/C++ from Python? [closed]
(12 answers)
Closed 11 months ago.
I am mainly using python for extensive algorithms operations. Now i have my webiste in Django.
I few libraries in c++ and few in Java which i don't have in python. Or you can say that i already have some c++ , Java files in which some algorithm is coded.
can i call those function or do some calculation in my djnago sites using those c++ or java files
For C++, certainly. Either write a module that wraps the library, or use something like ctypes or SWIG.
For Java, you'd be best to move to Jython (and correspondingly use django-jython).
Note that using both C++ and Java from Python is not trivial.
I've used Boost.Python to some degree of success for accessing C++ libraries within Python/Django.
You could check the http://www.scipy.org/Weave weave package for C/C++. I didn't use it myself, but I know it exists

Categories

Resources