title: Running Python code from Java program, should i be doing this?
body: <p>i have a scenario where i draw a network and set all it's parameters on swing based GUI, after that i have to translate this network into a python based script which another framework reads and realize this network in the form of virtual machines.  </p>
  
  <p>As an example have look here:  </p>
  
  <pre><code>from mininet.topo import Topo, Node
  class MyTopo( Topo ):
      def *__init__*( self, enable_all = True ):
          super( MyTopo, self ).__init__()
          Host = 1
          Switch = 2
          self.add_node( Switch, Node( is_switch=True ) )
          self.add_node( Host, Node( is_switch=False ) )
          self.add_edge( Host, Switch )
          self.enable_all()
  topos = { 'mytopo': ( lambda: MyTopo() ) }
  </code></pre>
  
  <p>It simply connects a <code>host</code> to a <code>switch</code> and realize this topology on a python framework.<br>
  Now for now in order to realize the drawn network on Java GUI here is what i am doing:  </p>
  
  <p>I simply take the information from GUI and create a new python file like the one above using Java code and then run this file in mininet using <code>ProcessBuilder</code> Class in Java, which works fine somehow.  </p>
  
  <p>I want to know, is this the correct and robust way how i am doing this or should i be looking further into java-python bridge like scenarios to be more effective or so as to say more professional.</p>
  
  <p><strong>EDIT:</strong>  </p>
  
  <p>The options i was wondering are:    </p>
  
  <ol>
  <li><p>Serialize the GUI in a well known format (yaml maybe?) that can be deserialized by python and then add additional functionality in python to pass that information to this script.  </p></li>
  <li><p>Add a Java-Python bridge to do this directly from within the code??  </p></li>
  <li><p>Any other idea?     What should i do, or im good at whatever is being done here.</p></li>
  </ol>