469,306 Members | 1,901 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

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 15086
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by OmyGOD | last post: by
1 post views Thread by Jerry | last post: by
2 posts views Thread by zhong.zx | last post: by
1 post views Thread by Rithish | last post: by
reply views Thread by cosmicxdust | last post: by
reply views Thread by srinivasmsr | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.