Linking Erlang with a Java library - java

This is probably an ultra-novice question. Say, I sell a client/server product, e.g. a database. The server is written in whatever and to communicate with it your program has to link a native client library which I supply. I do not have an Erlang client library, but I have a Java one. Is there a feasible way to run a JVM inside an Erlang process and thus call from Erlang into a Java lib? Dumb idea?

Related

Java Projects on Django?

ok, So i searched net for the possible implementation but all that I managed to find is Django projects implementation on Java platform through Jython. But I want to do the reverse, i.e. implement/integrate java project ( which in my case is SAIKU server ) on Django platform.
The question being, is it possible, and if yes, then kindly point me to the solution.
Thanking in advance =)
For your specific requirement, I would suggest using RESTFul API to access the Saiku Server.
However if you need to run Java Classes from Python.
Here are the options available for you:
JCC -- a C++ code generator for calling Java from C++/Python. It produces producing Python extensions which communicate via JNI with a Java virtual machine. As it implies, this would require compilations of every possible call. However this project is backbone of PyLucene project.
CodeMesh. C++ code generator for Java.
Py4J Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.
JPype allow python programs full access to java class libraries. It is done through interfacing at the native level in both Virtual Machines. However there are no recent development in this front.
In general, having an loosly coupled integration through REST or RCP would be easy to maintain than tightly coupled JNI based implementation.
There's no way to run Java within the Python runtime (which is what it sounds like you want). There are Java to Python "translators" available, but they're terrible. Honestly, if you need a Java server and Django to sit inside the same process for some reason, Jython is the way to go.
There are lots of options outside of that though, off the top of my head:
Implement Python bindings for your server (See PyLucene for an example)
Implement a socket server within your Java server that Python can talk to directly

Interprocess communication between XCode (Objective C) and Java RMI

I have an RMI application that has service implementation and it has a lot of code in it and I do not want to redo the business logic just to support an iPhone app.
Could someone assist me on a best way to access these RMI services using Objective C? Or is there any other way for making this possible, please let me know if this is a terrible question, being a software programmer, I would expect that there would be a way for heterogeneous programs to communicate with each other, so this question comes to me with that assumption.
There's no Java runtime in iOS, nor any support for Java in the SDK, and an Objective-C app can't start up another process on the device (unless it's jailbroken), so there'd be no way for your app to run a JVM. So the only other option I know of (short of rewriting the Java code) would be to make your Java functionality available via web services.
Also, there's no direct way for applications to communicate with each other (or for that matter to even be running in the foreground simultaneously) in iOS.

voip client using h.323 in java

i am trying to write a voip client using h.323 in java and i was wondering if someone could point me as to which api is available in java and if there is any tutorial available for it.anything relevant would be really appreciated. thanx
You don't have many options for H.323 in Java. The best is probably OPAL. It includes a Java wrapper to use the C++ class libraries that allow you to implement a Java H.323 client.
IBM used to have a native Java H.323 stack, but I'm not sure if that is maintained anymore.

Best way to deal with COM ports for a cross-platform program?

I am writing an application which need to send data to a serial device attached to a COM port.
I am confused as to what is the best way to deal with such a device?
Shall I write the communication module in C++ or shall I write this in Java?
I want to run the application on Windows as well as Linux.
On Linux I would recommend libserial. You could also consider using Python. There is a multi platform pySerial module. If you decide for Java, rxtx is a multi platform library. On Windows you may use the Windows API for serial communications and combine it with libserial using #ifndef as #Dharma suggested.
I recommend you:
Boost ASIO
QextSerialPort (based on Qt)
You can write the module in c++ by specyfying the #ifndef "_WINDOWS_CODE" for windows code and else part for the linux code.
while compiling in Vc++ put the (_WINDOWS_CODE)macros in the projecty settings
and in gc++ remove the macro from project file
COM port is just a plain bit pipe. The APIs are expected to be fairly simple. In C++, the world has much more experience with writing to ports.
Other question would be - do you know what port number it is? There're several ways to find out which one is yours, like setup API on windows.
My suggestion, if you want to run you application in both linux and Windows, go for JAVA!. you can run your program without any need of compilation. otherwise you have to distribute seperate binary for both Windows and Linux.
Also programming model in both windows and linux for accessing SerialPort in C++, As i am preliminary a Windows C++ developer, you can use CreateFile WIn32 Api to access serial port.
shall i write the communication module
in C++ or shall i write this in JAVA?
Which are you more familiar with? Are you limited to these two languages? You could also use python with pyserial.
Are you doing this as a personal project? Is it for work? Is someone else working on this with you? What are they more familiar with?
For C++ you could use Boost.Asio.
For Java ... I don't know.

Php/Java Integration

Have you experience of integration of php and Java? I've written a class in Java "Hello". Now I want to call its method from php when I create an instance of this class from php with
$obj = new Java(Hello);
Then it gives me fatal error. I've tried many times to setup php ini variables etc but I couldn't find anything. Please advice me how can I set it up.
Thanks in advance
Reference: http://php.net/manual/en/book.java.php
Have a look at:
PHP-Java Bridge
The PHP/Java Bridge is an
implementation of a streaming,
XML-based network protocol, which can
be used to connect a native script
engine, for example PHP, Scheme or
Python, with a Java virtual machine.
It is up to 50 times faster than local
RPC via SOAP, requires less resources
on the web-server side. It is faster
and more reliable than direct
communication via the Java Native
Interface, and it requires no
additional components to invoke Java
procedures from PHP or PHP procedures
from Java.
Could it be you are just missing the quotes around the Java Class? Also make sure you actually do have a Java VM on the machine you are trying to run the code on and make sure you have properly set up the config options. Also, the Java extension is a PECL extension and has to be installed. It is not part of the native distribution. Furthermore, the extension is considered unmaintained and dead, so you might want to have a look at the JavaBridge suggested elsewhere. Zend Server also brings a JavaBridge.
Check out this article: http://www.devshed.com/c/a/PHP/Using-PHP-with-Java/
They say it's possible (and how to do it). I've never done it, so I can't vouch for it...
In my experience the best way to interact between Java and PHP is through a WebService layer. NuSoap for PHP is very good, and you can consume the webservice in Java to create a stub that will build the request/response object.
There are many ways few are:
PHP Java Bridge
Java Integration in PHP
Using web services to pass data in between like SOAP
Using simple HTTP data passage between Java and PHP see (facejar uses the same technique)
Client site script (AJAX)
If you are after security, use option 1 otherwise I prefer using option 4 which is a bit faster when it comes to performance.

Categories