title: Getting Processing to read Java file output/values
body: <p>I'm writing a program to read the button values from a VRPN device using Processing with a sample Java file that works perfectly in the command line.</p>
  
  <p>I've already set up my sketch folder with the appropriate library/files, I just need to reconfigure the Java code to send values over to the PDE side of things (currently System.out.println()). I've tried establishing a PApplet object but had trouble configuring it within the ButtonTest class. I've tried researching this sort of functionality within Java but have had trouble finding the right terminology. Any help would be greatly appreciated!</p>
  
  <pre><code>import vrpn.*;
  import processing.core.PApplet;
  
  public class ButtonTest implements vrpn.ButtonRemote.ButtonChangeListener {
  
  
    public void buttonUpdate( ButtonRemote.ButtonUpdate u, ButtonRemote button) {
      System.out.println( "Button message from vrpn: \n" +
    "\ttime:  " + u.msg_time.getTime( ) + "  button:  " + u.button + "\n" +
    "\tstate:  " + u.state );
    }
  
    public static void main(String[] args) {
  
      String buttonName = "spaceNav@127.0.0.1:3891";
      ButtonRemote button = null;
  
      try {
        button = new ButtonRemote( buttonName, null, null, null, null );
      } 
  
      catch(InstantiationException e) {
        // if fails
        System.out.println( "We couldn't connect to button " + buttonName + "." );
        System.out.println(e.getMessage());
        return;
      }
  
      ButtonTest test = new ButtonTest(pa);
      button.addButtonChangeListener(test);
    }
  }
  </code></pre>
  
  <p>My file structure: (PDE file is currently empty/ready and waiting)</p>
  
  <p><a href="https://i.stack.imgur.com/mUCZj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mUCZj.png" alt="My file structure"></a></p>
  
  <p>Just for reference I've managed to send values from a Java file to a Processing sketch seen here, I just can't seem to implement it for this project <a href="https://forum.processing.org/two/discussion/3677/" rel="nofollow noreferrer">https://forum.processing.org/two/discussion/3677/</a></p>