By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

how to call a java method from php

P: 3
HI friends,

i have a problem when i call a java method from php code, i saw site ifollow all thr steps , but i got the classNotFoundExceptions.

my code is like this


Expand|Select|Wrap|Line Numbers
  1. public class SampleStatic
  2. {    
  3.     public static void main(String args[])
  4.     {
  5.         System.out.println("saibaba");    
  7.     }
  8.     public void sample(int arg)
  9.     {
  10.         System.out.println("hai"+arg);
  11.     }
  12. }
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("");
  3. $sample = new Java("SampleStatic");
  4. $sample->sample(10);
  5. ?>
I am using vm php bridge jar file.

if any one know please tell me.

Thanks and Regards

Mar 25 '10 #1
Share this Question
Share on Google+
2 Replies

P: 50
Umm I don't think you can include Java code like you do regular PHP code. Meaning that your require_once( "" ); shouldn't contain Java it should contain PHP you'd need to look into the Java extension and find the correct way of including files.
Mar 25 '10 #2

P: 3

This contasins php code only this file was given by the vm bridge driver.If we donot include i got another error . if I include java.ince run the predefine java class it will work.But if we run the our custom classes we got the classNotFoundException.
So if any know ,please tell to me

Thanks and Regards

swamy vnvs
Apr 1 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.