944,018 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 12175
  • Java RSS
Aug 13th, 2005
-1

is it possible for PHP to call API written on java ? HELP

Expand Post »
Hi there,

I have some problem with accessing API using PHP. Here is the story :
I use PHP as my main script on my webserver.
I want to retrieve data in database server (oversea).
The database server provides API and it's available to download.
So I download the API but dont know how to use it....
oh yes, the API is bundled in .jar file. There are example files but all of them are written in java and there are something about java rmi etc....

please help me to find a way to retrieve data from the database. can i use API? how to use it? is it possible for PHP to call API written on java


Thank you very much
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ms88 is offline Offline
5 posts
since Jun 2005
Aug 14th, 2005
0

Re: is it possible for PHP to call API written on java ? HELP

No, but you could use JSP...
Reputation Points: 17
Solved Threads: 5
Posting Whiz in Training
mmiikkee12 is offline Offline
274 posts
since Oct 2004
Aug 14th, 2005
0

Re: is it possible for PHP to call API written on java ? HELP

Or write a Java program that runs constantly and can communicate in some way (probably through SOAP) with your PHP application and use that as middleware.

But indeed, moving to a JSP/Servlet environment is the best option by far.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Aug 14th, 2005
0

Re: is it possible for PHP to call API written on java ? HELP

Thank you very much for the replies.....
I already setting up the apache using php_java bridge and it works well (the PHP can access all java class, such as java.lang etc).....

yes, write java application and php connect to the java application could be possible. However, im not quite sure how to call the class. There is a java example using the API which is run in command line. To run or compile this example, i have to call : java -classpath .:../<API jar file> <classname>...........how can avoid this problem?

another question : The class which i want to call is in jar file. It's in directory, say : aaa/bbb/ccc/ddd/eee......how to instantiate a class which is in a sub directories?

is it possible for me to just instantiate the API class (API available from the database server) and call the methods on it?


Cheers.....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ms88 is offline Offline
5 posts
since Jun 2005
Jun 9th, 2009
0

Re: is it possible for PHP to call API written on java ? HELP

Reputation Points: 10
Solved Threads: 0
Newbie Poster
albertolarrea is offline Offline
1 posts
since Jun 2009
Jun 9th, 2009
0

Re: is it possible for PHP to call API written on java ? HELP

Click to Expand / Collapse  Quote originally posted by ms88 ...
Thank you very much for the replies.....
I already setting up the apache using php_java bridge and it works well (the PHP can access all java class, such as java.lang etc).....

yes, write java application and php connect to the java application could be possible. However, im not quite sure how to call the class. There is a java example using the API which is run in command line. To run or compile this example, i have to call : java -classpath .:../<API jar file> <classname>...........how can avoid this problem?

another question : The class which i want to call is in jar file. It's in directory, say : aaa/bbb/ccc/ddd/eee......how to instantiate a class which is in a sub directories?

is it possible for me to just instantiate the API class (API available from the database server) and call the methods on it?


Cheers.....
I am guessing that "aaa/bbb/ccc/ddd/eee" is a package name. So, use aaa.bbb.ccc.ddd.eee.YourClassName. Make sure that the path of .jar must added with CLASSPATH env; variable.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Dec 29th, 2010
0
Re: is it possible for PHP to call API written on java ? HELP
Click to Expand / Collapse  Quote originally posted by ms88 ...
Thank you very much for the replies.....
I already setting up the apache using php_java bridge and it works well (the PHP can access all java class, such as java.lang etc).....

yes, write java application and php connect to the java application could be possible. However, im not quite sure how to call the class. There is a java example using the API which is run in command line. To run or compile this example, i have to call : java -classpath .:../<API jar file> <classname>...........how can avoid this problem?

another question : The class which i want to call is in jar file. It's in directory, say : aaa/bbb/ccc/ddd/eee......how to instantiate a class which is in a sub directories?

is it possible for me to just instantiate the API class (API available from the database server) and call the methods on it?


Cheers.....

Since you said you are calling java from php ... using java-php bridge... can u please list me down the steps ... as i am unable to do the same ... Thanks in advance!!
Reputation Points: 8
Solved Threads: 0
Light Poster
mdew_47 is offline Offline
29 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Insert main function
Next Thread in Java Forum Timeline: Strange Applet Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC