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

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.

Related

The difference between framework code and ordinary code [duplicate]

This question already has answers here:
What is a software framework? [closed]
(12 answers)
Closed 3 years ago.
Can someone just show me an example of a code snippet that is meant for a framework (Spring or Guice) vs how it would be written in an ordinary form? It could be any framework for either C++ or Java
The C++ language doesn't make that distinction. A "framework" is often a library that provides a more-or-less coherent set of types, objects, and functions for solving a particular class of problems. For example, a GUI framework manages a graphical user interface; a Unit Testing framework supports unit testing, etc.
When you build a library you use a librarian to combine various object files together into a library file. When you build an application using that library you link to the library; the linker pulls in the various parts of the library that your program uses.

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.

calling C functions in java [duplicate]

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

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

How can I translate a perl script to Java? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I convert OO Perl to Java?
Hello.
I have a perl script and I want to translate it to Java.
Is there any translator/conversor from perl script to Java?
By the way, I'm developing an Android 2.2 application.
EDIT
I have closed the question. Stop downvoting me!!!!!! And if you downvote tell us why!!
Thanks.
You should consider using the Android Scripting Environment so that you can just use your Perl script rather than having to "translate" it to Java (especially if you plan on relying on some translation tool to do it).
It supports Perl, along with Python, Ruby, and some others.
Just my two cents...
I would convert the Perl to Java by hand that way you are 100% in control of the Java code running in your Android application and that way you will understand what the Perl code is actually doing rather than relying on it to work when there is a bug in your Android app.
No. There's the JPL project from the 90's that might've been a workaround, but I'm pretty sure it fell apart along the road.

Categories

Resources