Is there any way to run java code on xampp alongside PHP code. In my PHP application, I intend to use the exec() function to run a java program. I'm using xampp for PHP and MySQL and I'm using Netbeans for Java. Is it possible to run java on xampp? Both my PHP code and Java code will be running queries on the same MySQL database. My version of xampp contains Apache, MySQL, FileZilla, Mercury, and Tomcat. Are any of these java-compatible?
Asked
Active
Viewed 977 times
0
-
Tomcat can runs java servlets. but your `exec()` left me wondering, whether you're going to make a webservice-like or just execute any of them like a command line program.. – Bagus Tesa Jan 18 '17 at 02:30
-
My PHP application is purely backend and there will be no user input nor front-end interaction of any kind. The PHP application modifies database values via MySQL queries. The Java code also executes queries on the same database. The bulk of the application is easiest to write in PHP, so that's why I'm making it mainly PHP. However, one portion of the code has to be written in Java since it uses 3rd party java libraries to carry out a certain task. In the database, I'm creating a table to use as a bridge for passing the values of important PHP variables into the java code. – ron136 Jan 18 '17 at 02:44
-
yep, you can use `exec()`, you can [read more on this SO question](http://stackoverflow.com/questions/2128619/run-java-class-file-from-php-script-on-a-website). – Bagus Tesa Jan 18 '17 at 02:46
-
Thanks for the link. I'm aware that I can use exec() to run the java application. My question is geared more towards asking if it would work in xampp. My PHP files are in a folder called htdocs in xampp, and my MySQL database is part of the xampp software (phpMyAdmin). But my Java project is in Netbeans. I mean to ask if there's any way to move my Java code and libraries to xampp so they can run. Or can I can get xampp to access my code in Netbeans to run it. The other thread mentions a PHP/Java bridging software so I'm going to check that out. – ron136 Jan 18 '17 at 03:08
-
1*f there's any way to move my Java code and libraries to xampp so they can run* --> compile it into jar and put them somewhere? refer them with absolute file path. – Bagus Tesa Jan 18 '17 at 03:17
-
Thanks. I'll do this. – ron136 Jan 18 '17 at 05:29