title: VirtualBox Java API - Get IP Address of VM in VirtualBox
body: <p>I have question related to getting IP address, I referred to few online resources and some answers already but I was not able to still fix it,
  <a href="https://forums.virtualbox.org/viewtopic.php?f=34&amp;t=65910" rel="nofollow">https://forums.virtualbox.org/viewtopic.php?f=34&amp;t=65910</a> - link that most matched with my question.</p>
  
  <p>Configuration : 
  <code>
  Host Machine : Windows 8
  Guest : Slitaz 4.0
  VirtualBox : 4.3.24
  VirtualBox Java API : 4.3
  Adapter in VM : Host Only Adapter
  Slitaz Guest Additions are also installed.
  </code></p>
  
  <p>I have created a Java program using VirtualBox API and I can basically connect, clone and start a VM in VirtualBox. But what I was not able to do is get the IP address of machine. (Why I need IP is because I want to SSH into that machine, using JSCH java library and execute some processes)</p>
  
  <p>This is what I tried so far,</p>
  
  <p>Based on the link mentioned above, </p>
  
  <pre><code> machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/&lt;nicid&gt;/V4/IP") - returns empty result
   machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/Count") - returns empty result
   machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/&lt;nicid&gt;/MAC") - return empty result
   machine.getGuestPropertyValue("/VirtualBox/GuestInfo/OS/Release") - this gives me release version of linux - which is ok
  </code></pre>
  
  <p>I tried this one more thing, how many properties are exactly available</p>
  
  <pre><code> org.virtualbox_4_3.Holder&lt;List&lt;String&gt;&gt; tempList = new Holder&lt;List&lt;String&gt;&gt;();
   org.virtualbox_4_3.Holder&lt;List&lt;String&gt;&gt; tempList1 = new Holder&lt;List&lt;String&gt;&gt;();
   Holder&lt;List&lt;Long&gt;&gt; tempList2 = new Holder&lt;List&lt;Long&gt;&gt;();
   org.virtualbox_4_3.Holder&lt;List&lt;String&gt;&gt; tempList3 = new Holder&lt;List&lt;String&gt;&gt;();
   machine.enumerateGuestProperties("",tempList, tempList1,tempList2,tempList3);
  </code></pre>
  
  <p>Now in templist, I get name of all properties available and in tempList1 it's values.</p>
  
  <p><code>[/VirtualBox/GuestInfo/OS/Product, /VirtualBox/HostInfo/GUI/LanguageID, /VirtualBox/HostInfo/VBoxVerExt, /VirtualBox/GuestAdd/Vbgl/Video/SavedMode, /VirtualBox/GuestInfo/OS/Version, /VirtualBox/GuestAdd/VersionExt, /VirtualBox/GuestAdd/Revision, /VirtualBox/HostGuest/SysprepExec, /VirtualBox/GuestAdd/Vbgl/Video/0, /VirtualBox/HostGuest/SysprepArgs, /VirtualBox/GuestAdd/Version, /VirtualBox/HostInfo/VBoxRev, /VirtualBox/HostInfo/VBoxVer, /VirtualBox/GuestInfo/OS/Release, /VirtualBox/GuestAdd/HostVerLastChecked]</code></p>
  
  <p>That is the reason, I think this works</p>
  
  <p><code>machine.getGuestPropertyValue("/VirtualBox/GuestInfo/OS/Release") - this gives me release version of linux - which is ok</code></p>
  
  <p>But there is no property related to IP. Also I am not sure what exactly here is nicid and how to get this using API, is it mac address of adapter in VM, or something else. </p>
  
  <p><code>machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/&lt;nicid&gt;/V4/IP")</code></p>
  
  <p>Can somebody please help me out here or guide in appropriate direction.</p>