1

I am executing a Java class in PHP using PHP-Java Bridge following Official documentation. I have moved NewFile.jar in lib folder in web apps/WEB-INF folder of tomcat I am creating a file in java then calling that java class in PHP which will create a file in that particular location. Unable to create file, I don't know what is happening?

File NewFile.java

import java.io.File;
import java.io.IOException;

public class NewFile {
   public static void main(String[] args) {
      try {
         File file = new File("E:/myfile");

         if(file.createNewFile())System.out.println("Success!");
         else System.out.println ("Error, file already exists.");
      }
      catch(IOException ioe) {
         ioe.printStackTrace();
      }
   }
}

File: test.php

<?php 

require_once("http://localhost:8080/JavaBridge/java/Java.inc");
echo "Hello";
$data = new java("NewFile");

?>

This is what i getting in front-end

enter image description here

Is their problem in my setup or what can anyone help me out?

Thanks

akshay patil
  • 670
  • 7
  • 20
  • This [answer](https://stackoverflow.com/questions/2128619/run-java-class-file-from-php-script-on-a-website) help you? – Simone Rossaini Dec 30 '19 at 10:52
  • What have you tried and didn't work? please add source code of your specific problem – Karim Dec 30 '19 at 10:53
  • @akshaypatil if you tried the guide you linked, which is the problem? – Simone Rossaini Dec 30 '19 at 10:57
  • "Official Documentation Didn't help me?" yet absolutely no description from you of what is going wrong. – delboy1978uk Dec 30 '19 at 10:58
  • Does this answer your question? [Run Java class file from PHP script on a website](https://stackoverflow.com/questions/2128619/run-java-class-file-from-php-script-on-a-website) –  Dec 30 '19 at 11:04
  • what's the name that you put in the file MANIFEST.MF – Karim Dec 31 '19 at 10:49
  • from your app it seems you need to follow this part of the documentation http://php-java-bridge.sourceforge.net/pjb/desktop-apps.php – Karim Dec 31 '19 at 10:55

0 Answers0