0

Well, I did following steps to call java class or methods or even simple output to my localhost

  1. I install java SE which is successfully working
  2. I check through CMD that my javac is working or not and it's working
  3. I also use to run Java/php bridge.war file using following command java -classpath JavaBridge.war TestInstallation works fine

But now when I am trying to execute following code:

<?php 
        require_once("java/Java.inc");
        //echo java("java.lang.System")->getProperties();
        require_once("first.java");
        //require_once("apples.class");
        //exec("java -version",$output);
        //print_r($output);//return empty....:(
        //$obj = new Java("apples.class");  
    ?>

Expected output is:

Hello only

Coming output is following whole code of first.java file

class apples{ public static void main(String args[]) { System.out.println("Hello only"); } }

I don't know what to do? It's just simple java code but later on using more complex code.... first.java file code:

 class apples{
        public static void main(String args[])
        {
            System.out.println("Hello only");
        }
   }

Please help me in simple manner thanks.....in advanced:)

Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79
Jimil
  • 650
  • 2
  • 14
  • 37
  • Have you opened the file "java/Java.inc" to see what it contains? – Alvin Bunk Oct 06 '14 at 03:52
  • Yes, I did but it's contain following which I am not sure should I edit or not.....# define ("JAVA_HOSTS", 9267); define ("JAVA_SERVLET", false); # define ("JAVA_HOSTS", "127.0.0.1:8787"); # define ("JAVA_HOSTS", "ssl://my-secure-host.com:8443"); # define ("JAVA_SERVLET", "/MyWebApp/servlet.phpjavabridge"); # define ("JAVA_PREFER_VALUES", 1); – Jimil Oct 06 '14 at 04:11
  • http://stackoverflow.com/questions/2128619/run-java-class-file-from-php-script-on-a-website – Tirath Oct 06 '14 at 05:33
  • http://stackoverflow.com/questions/15860236/execute-java-class-in-php – Tirath Oct 06 '14 at 05:36

0 Answers0