473,396 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to call a java method from php

HI friends,

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

my code is like this


JavaClass

Expand|Select|Wrap|Line Numbers
  1. public class SampleStatic
  2. {    
  3.     public static void main(String args[])
  4.     {
  5.         System.out.println("saibaba");    
  6.  
  7.     }
  8.     public void sample(int arg)
  9.     {
  10.         System.out.println("hai"+arg);
  11.     }
  12. }
PhpCode
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("Java.inc");
  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

swamy
Mar 25 '10 #1
2 2366
Umm I don't think you can include Java code like you do regular PHP code. Meaning that your require_once( "Java.inc" ); 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
Hi,

This Java.inc contasins php code only this file was given by the vm bridge driver.If we donot include java.inc 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

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

Similar topics

2
by: parthan | last post by:
We are running our c++ program as Windows services which uses JNI. > Program is getting CLASSPATH env variable correctly and also > initializes JVM successfully. After initializing JVM, programs...
0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
0
by: aychai | last post by:
Hi all, I am trying to make use Oracle9i db to call an external .Net Web Service from a JAva Stored Procedure. I created the .Net Web Service and use JDeveloper 9.0.3.4Build(1247) to create...
0
by: mailkhurana | last post by:
Hii , I am trying to use a type 2 driver to connect to DB2 0n AIX 5 I have a small java test to class to establish a conneciton with the db .. I am NOT using WAS or any appserver When I try to...
3
by: evelyne0510 | last post by:
Hi all, I have created a XML-RPC model (with server and client) written in Java. I want to call the methods in another XML-RPC model written in Python. I know that in Java, I can use like...
2
by: Christophe Elek [IBM] | last post by:
All, a couple months ago i found a java property that would allow me to trace the method in/method out of my packages it looked like java -D<property>=org.mypackage.* <main class> Which...
2
by: mhust6 | last post by:
I am trying to call a java method from within my Javascript, but cannot seem to get it to work. All the examples I have found online and in the forums are using Java applets. I have a method that...
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
11
by: BigZero | last post by:
Hello, can i call Java method.That is java code from php,here what i m looking for i have class called DB in this class all the DB related things ,like DB connection DB insert,DB read etc...
1
by: manjava | last post by:
hello, i want to test my service web i write this class to call my method appel:import projetd.MagasinServicesStub.ListeMagasinProcheDeResponse; import java.rmi.RemoteException; public class...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.