rhiegen Posted November 2, 2008 Share Posted November 2, 2008 Hi there, I've made a Java class and put the .class file in the same folder my .php is. Then I tried to call my java class in the way below without any success, but also without any error notice. echo '<pre>'; echo $host; $output = array("dns_ip_number_here","A","www_domain_here"); $return_var = ""; exec("java NsLookup $output); $output_str = join($output, "\n"); echo "<pre>The output was:\n$output_str\n\n"; echo "The return value was $return_var</pre>"; If anybody can help me I would be thankfull, Rhiegen PS: I've tried shell_exec even without any success. I'm using xampp 2.5, java jdk 1.6. I have tested my class in the same folder using java NsLookup ip_dns A domain_name and it was successfull. Quote Link to comment https://forums.phpfreaks.com/topic/131034-calling-java-classes-using-php/ Share on other sites More sharing options...
ratcateme Posted November 2, 2008 Share Posted November 2, 2008 for starters there is a whole library of network functions capable of doing DNS lookups http://nz.php.net/manual/en/ref.network.php for your script to work it will be looking like "java NSLookup Array(" because that is how PHP handles arrays try it like this $output = "dns_ip_number_here A www_domain_here"; $return = shell_exec("java NsLookup $output); echo "<pre>The output was:\n$return\n\n"; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/131034-calling-java-classes-using-php/#findComment-680381 Share on other sites More sharing options...
.josh Posted November 2, 2008 Share Posted November 2, 2008 In addition to ratcateme's advice, small typo in your script that may or may not influence the outcome: You forgot the closing quote on this line: exec("java NsLookup $output"); Quote Link to comment https://forums.phpfreaks.com/topic/131034-calling-java-classes-using-php/#findComment-680397 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.