title: how to get a string from java function in php
body: <p>I have written 2 java codes (FullTextIndexer.java and Indexer.java) FullTextIndexer has functions :</p>
  
  <pre><code>public static StringBuilder do_exist = null;
  public static String do_exist_str;
  public static String a_value = new String("my_string");
  public static void main(String[] args){ 
      //... here I find "do_exist" value by using "Indexer.java" and printed it with system.out.println; which is the correct value
      do_exist_str = do_exist.toString();
  }
  public static String get_file()
  {
      main(args);
      return do_exist_str;    
  }
  </code></pre>
  
  <p>Then I compiled it and compress it as FullTextIndexer.jar and put it into my WEB-INF/lib folder.
  And in my php code :</p>
  
  <pre><code>require_once("java/Java.inc");
  $session = java_session();
  
  $t = new Java('java.lang.System');
  $t=new Java("web_java.FullTextIndexer");
  $gotten = java_values($t-&gt;get_file());
  $a_value = java_values($t-&gt;a_value);
  echo $gotten;
  echo sizeof($gotten);
  echo $gotten[0].$gotten[1];
  </code></pre>
  
  <p>I expect to get my file_name string however I always get an array like {0=0, 1=0} of size 2. 
  But it writes $a_value correctly. 
  I guess it finds its value in main(args) but erase afterwards and cannot return "do_exist_str" correctly. 
  I cannot find a way to get this string correctly. Any help will be appreciated. Thanks in advance</p>