473,415 Members | 1,545 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,415 software developers and data experts.

PHP5 Java Bridge Configuration

Hi--

I seem to have the PHP Java Bridge (2.0.5 built from tarball) working with
PHP 5.0.3 (also built from tarball) on my Fedora Core 1 server with Apache
2.0.50 and I'm pretty excited about it all. There are a couple of
configuration issues I've run into that are perplexing me.

First, I can't seem to change the classpath. I've added:

[java]
java.class.path="/path/here"

to the php.ini file, just as indicated in setup documentation, phpinfo()
still reports only JavaBridge.jar in the classpath in the java section.

Without being able to add to the classpath, I can't access the Java objects
that I've built, so you can see how this could be a problem. =^)

Is there anyone that's set up the Java Bridge with PHP5 and gotten it
working? Obviously I'm tinkering in the wrong places.

It occurs to me that maybe the bridge doesn't work at all with .class files
and that in order to use these I'll need to package them in .jar files.
That's just an off-the-wall theory.

I'm a little disappointed in the bridge, although very excited about the
potential. PHP advocates have been talking about "Native Java Support" in
PHP since 2001 and even PHP5 requires some not-insignificant jumping-through
of hoops to add Java-PHP integration. Or is there something I'm totally
missing?

Thanks,
Steve

Jul 17 '05 #1
9 15388
Hi,
I've added: java.class.path="/path/here"
to the php.ini file, just as indicated in
setup documentation
In which setup documentation have you found this? According to the
README it is java.classpath. That aside, you're right, the
documentation is currently in a horrible state, it's just that I don't
have enough time to work on it at the moment.

that I've built, so you can see how this could be
a problem. =^)


The recommended method is to create a .jar file and store it in
/usr/share/java or in %JAVA_HOME%\jre\lib\ext (on windows) for
example, please see the INSTALL and README document. -- BTW: Why do
you want to load individual class files?
Regards,
Jost Boekemeier
Jul 17 '05 #2
Hi, and thanks for responding

On 4/2/05 1:37 AM, in article
c7**************************@posting.google.com, "jo******@yahoo.de"
<jo******@yahoo.de> wrote:
In which setup documentation have you found this? According to the
README it is java.classpath. That aside, you're right, the
documentation is currently in a horrible state, it's just that I don't
have enough time to work on it at the moment.
Arrgh. It looks like I was looking at the docs for the default Java Bridge
that comes with PHP4, not yours. Someone slap me.
The recommended method is to create a .jar file and store it in
/usr/share/java or in %JAVA_HOME%\jre\lib\ext (on windows) for
example, please see the INSTALL and README document. -- BTW: Why do
you want to load individual class files?


The only reason being that I'm doing development and testing and I want to
be able to edit and swap classes out with emacs and javac. I'd like to add
to the classpath because I have a group of files I'm working on that I want
to keep in their own place. I guess the jarfile is how I keep everything in
one place though?

Thanks,
Steve

Jul 17 '05 #3
On 4/2/05 1:37 AM, in article
c7**************************@posting.google.com, "jo******@yahoo.de"
<jo******@yahoo.de> wrote:
The recommended method is to create a .jar file and store it in
/usr/share/java or in %JAVA_HOME%\jre\lib\ext (on windows) for
example, please see the INSTALL and README document. -- BTW: Why do
you want to load individual class files?

Does this mean that putting class files into /usr/share/java is not expected
to work? Judging by the "Uncaught thrown" error that I'm getting,
/usr/share/java is NOT in the classpath, or else .jar files are recognized
and .class files are not.

Also, classpath is reported only as

classpath=/usr/local/lib/php/extensions/no-debug-non-zts-20041030/JavaBridge
..jar

By phpinfo, so I'm clearly not doing something right.

Arrgh.
Steve

Jul 17 '05 #4
> Does this mean that putting class files into /usr/share/java is not expected
to work?
Exactly. /usr/share/java is the global repository for java archives.
Please see http://www.jpackage.org/ for details. jpackage is part of
the desktop java project supported by RedHat. -- It's really a shame
that OS projects have to correct problems that Sun cannot or is not
willing to change since more than 5 years. Please help us to stop
this classpath nonsense which causes that multiple versions of classes
are scattered all over the directory structure (belonging to different
users, have different permissions etc, etc...).

Also, classpath is reported only as
classpath=/usr/local/lib/php/extensions/no-debug-non-zts-20041030/JavaBridge
.jar


Please don't forget the double-quotes, please see
http://php-java-bridge.sourceforge.net/#ini-options for details.
Regards,
Jost Boekemeier
Jul 17 '05 #5
On 4/16/05 7:29 AM, in article
c7**************************@posting.google.com, "jo******@yahoo.de"
<jo******@yahoo.de> wrote:
Exactly. /usr/share/java is the global repository for java archives.
Please see http://www.jpackage.org/ for details. jpackage is part of
the desktop java project supported by RedHat. -- It's really a shame
that OS projects have to correct problems that Sun cannot or is not
willing to change since more than 5 years. Please help us to stop
this classpath nonsense which causes that multiple versions of classes
are scattered all over the directory structure (belonging to different
users, have different permissions etc, etc...).
Okaaaay.... What can I do to "stop the nonsense"? I'm not certain what
you're suggesting.

Please don't forget the double-quotes, please see
http://php-java-bridge.sourceforge.net/#ini-options for details.


OK, that solved my problem, and I feel kinda foolish. Thanks!

Is there a PHP/Java Bridge users forum somewhere? I suspect that I'm going
to have a lot more questions and fun with this as I go along. Neither
comp.lang.php nor any of the java newsgroups seem like the ideal place to
discuss.

Thanks,
Steve

Jul 17 '05 #6
> > this classpath nonsense which causes that multiple versions of classes
are scattered all over the directory structure (belonging to different
users, have different permissions etc, etc...).
Okaaaay.... What can I do to "stop the nonsense"? I'm not certain what
you're suggesting.


Please create a .jar file from your classes and store it as
/usr/share/java/myProject/myLibrary-version.jar or as `php-config
--extension-dir`/lib/myProject/myLibrary-version.jar. After that you
can reference your library with:

java_set_library_path("myProject/myLibrary-version.jar;<other
libraries...>");

at run-time.
(In versions prior to 2.0.6 it was necessary to use the full path i.e.
java_set_library_path("/usr/share/myProject/myLibrary-version.jar");)

That way you can specify exactly which library version you want and
you don't have to re-start the bridge if you want to add additional
libraries.

Please don't forget the double-quotes, please see
http://php-java-bridge.sourceforge.net/#ini-options for details.


OK, that solved my problem, and I feel kinda foolish. Thanks!


Yeah. The documentation is still evolving. Sorry for that.

Is there a PHP/Java Bridge users forum somewhere?


Either http://sourceforge.net/forum/?group_id=117793 or our mailing
list:
-> ph*******************@lists.sourceforge.net
To subscribe:
-> http://lists.sourceforge.net/lists/l...a-bridge-users

Archive:
-> http://sourceforge.net/mailarchive/f...a-bridge-users
Regards,
Jost Boekemeier
Jul 17 '05 #7
> bumeshraiwrote:
when I run a php page for writting out a file, I log the following error:
java.lang.ClassNotFoundException: Class java.io.FileOutputStream('workbook.xls') not found at php.java.bridge.DynamicClassLoader.loadClass(Dynam icClassLoader.java:358) at php.java.bridge.JavaBridgeClassLoader.forName(Java BridgeClassLoader.java:58) at php.java.bridge.JavaBridge.CreateObject(JavaBridge .java:450)
at php.java.bridge.Request.handleRequests(Request.jav a:197)
at php.java.bridge.JavaBridge.run(JavaBridge.java:142 )
at php.java.bridge.ThreadPool$Delegate.run(ThreadPool .java:20)

Did you require the *.jar that contians the class you were using?

Aug 31 '05 #8
Hello!
java.lang.ClassNotFoundException: Class

java.io.FileOutputStream('workbook.xls') not found
Did you require the *.jar that contians the class you were using?


I do not think that a class called
`java.io.FileOutputStream('workbook.xls')' exists, even though it is a
valid class name. 8)

You probably want something like java("java.io.FileOutputStream",
'workbook.xls'); instead of
new java("java.io.FileOutputStream('workbook.xls')");

:)

Sep 5 '05 #9
Hi Steven,
The problem is with class path.
u have to set class path as

java.classpath=/path/java/files

I'm sure that it will work for u.I faced same kind of problem and It was working fine for me

regards,
Pawan




Hi--

I seem to have the PHP Java Bridge (2.0.5 built from tarball) working with
PHP 5.0.3 (also built from tarball) on my Fedora Core 1 server with Apache
2.0.50 and I'm pretty excited about it all. There are a couple of
configuration issues I've run into that are perplexing me.

First, I can't seem to change the classpath. I've added:

[java]
java.class.path="/path/here"

to the php.ini file, just as indicated in setup documentation, phpinfo()
still reports only JavaBridge.jar in the classpath in the java section.

Without being able to add to the classpath, I can't access the Java objects
that I've built, so you can see how this could be a problem. =^)

Is there anyone that's set up the Java Bridge with PHP5 and gotten it
working? Obviously I'm tinkering in the wrong places.

It occurs to me that maybe the bridge doesn't work at all with .class files
and that in order to use these I'll need to package them in .jar files.
That's just an off-the-wall theory.

I'm a little disappointed in the bridge, although very excited about the
potential. PHP advocates have been talking about "Native Java Support" in
PHP since 2001 and even PHP5 requires some not-insignificant jumping-through
of hoops to add Java-PHP integration. Or is there something I'm totally
missing?

Thanks,


Steve
May 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: OmyGOD | last post by:
I am trying to bridge Java and PHP. We know there's php_java.dll in PHP4, but this module is not bundled in PHP5 packages. And there's no way to download this module. I tried to use php_java.dll...
1
by: Jerry | last post by:
My configuration is as follows. I have a Linux MySQL server database on one box and I want to connect to it from a local Windows XP laptop. My application was developed using SunOneStudio. I have...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
by: zhong.zx | last post by:
When I struggling to compile the php-java bridge on the following step on FreeBSD 4.11, I met error and cannot go through it: CMD: phpize && ./configure --with-java=/usr/java/jdk1.5.0 && make...
1
by: Rithish | last post by:
Has anyone sucessfully compiled PHP5 with JAVA support? Response is appreciated. Regards, Rithish.
4
pbmods
by: pbmods | last post by:
Heya. I just installed PHP-Java-Bridge on my system, but I'm having a hard time getting it to stop crashing Apache. When I activate the 'Java.so' module in php.ini, I get the following error in...
1
pbmods
by: pbmods | last post by:
Heya. I just installed PHP-Java-Bridge on my system, but I'm having a hard time getting it to stop crashing Apache. When I activate the 'Java.so' module in php.ini, I get the following error in...
0
by: cosmicxdust | last post by:
I am using Wamp5 v1.7.3 (PHP 5.2.4, Apache/2.2.4). When installing php-java-bridge-3.2.1_j2ee, I copy php_java.dll from PHP/Java Bridge to D:\php\ext. When I start all services, I got this Apache...
0
by: srinivasmsr | last post by:
please any body help me, how to install the php java bridge and configuration. i had php4.3 version.
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.