0

I need to develop a web application using PHP and the Apache web server. The application should call an external Java-based application which is stored in the host computer and pass the user's input value to this application which will analyse it and do something. I have been reading articles about PHP/Java and it seems that the best solution is to integrate a PHP into a Java servlet environment such as PHP/JavaBridge. As I am not an expert on web development and pretty ignorant on PHP, can someone tell me if this is the best solution and if not, what other possible approaches should I use it? Thanks in advance!

2
  • What kind of application are you trying to call? Is it a command line application written in Java, a web-based Java application, an applet? These types of applications require different methods to call them. Commented Feb 4, 2011 at 12:50
  • It's a standard stand-alone application, not web-based... Commented Feb 4, 2011 at 13:32

3 Answers 3

1

The application should call an external Java-based application which is stored in the host computer and pass the user's input value to this application which will analyse it and do something.

WebServices are perfectly suited here.

Also See

Sign up to request clarification or add additional context in comments.

Comments

1

You could do something like this:

$parameter1='your';
$parameter2='parameters';

$output = shell_exec("java whatever.jar $parameter1 $parameter2");

echo $output;

* Update *

I do agree with Jigar Joshi, though. I think a web service would be the best option here.

1 Comment

This is actually the answer to the question (thus the +1 vote). As starting the java runtime is quite expensive (for a web request) and results in a high latency, I do agree with the Update that Web services are a better answer to the problem.
0

You may explose your already existing java application api as web-services (jax-ws or jax-rs) and then use any application to call that. So you can write an web-wrapper around your java-webapp and then call it. First approach it better approach.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.