Summary
The VIX Java Toolkit allows Java developers to take advantage of the VMware VIX API. This is a powerful API that allows for performing in-guest operations on VMs running with vSphere, Workstation, Server, and Player. Java developers who are writing code with the vSphere/VI APIs will find this particularly useful as the vSphere API does not currently provide any functionality for interacting with the guest operating system. In addition, this is helpful for software testing as well as systems administration.
Features
- Provides Java wrapper for the VIX API
- Provides VIX objects and utility code to reduce complexities of using the VIX API
System Requirements
VIX Java Toolkit requires JDK 1.6 and the JNA library.
Instructions
To use VIX Java Toolkit, include jna.jar and vix.jar in your class path.
Video
Change Log
Engineers
![]() | Dan ParrellaWorks in the VIM Platform and Solutions QA group group. | |
![]() | Gavin GrayWorks in the VIM Platform and Solutions QA group group. |


Thanks for providing documentation…oh wait…that’s right you didn’t.
When i create an VixVmHandle, and then try to release it, apparently it is not releasing the vmhandle, and causing an issue that don’t allow me to interate with the VixVmHandle after the 30rd iteration.
Solved this problem. Some handles created by the toolkit were never released, so handles were created in the vix that were never released, so that the limit was exceeded for vm handles, which are 30.
If the developers are interested in the correction of the problem for an update, please contact.
Regards.
Weather vix.jar support vsphere 5.0 infrastructure?
m trying to connect to host through vixvsphereHandle but getting error ,.. Null exception.
i want to know .. weather vix.jar support above infrastructure ??
Waiting for your response >>
Available for now VIX API not support Java 1.6.x (64 bit).
Is VMWare plan to support this JVM in the future?
Thanks
I used the utility dependencywalker to determine the dependency of vix.dll. I found the following errors:
(1) DEVMGR.DLL Error opening file: The system cannot file the find specified.
(2) MSJAVA.DLL Error opening file: The system cannot file the find specified.
Warning: At least one delay-load dependency module was not found.
Any idea?
Tuan
In my class, I define jna.library.path as such:
static {
System.setProperty(“jna.library.path”, “C:\\Software\\VMWare\\VSphere-4.1″);
}
In Jboss’s start-up script. I set the JVM argument to to point to jna.library.path containing DLL’s
set “JAVA_OPTS=%JAVA_OPTS% -Djna.library.path=C:\Software\VMWare\VSphere-4.1″
When I run the code on Jboss server, I got a null pointer exception for the following code:
hostHandle = new VixVSphereHandle(“10.2.0.100″,443,”administrator”,”cf@dp@$$w0rd”);
It seems that Jboss could not find the DLL’s to link VixVSphereHandle.
Any idea?
Thanks,
Tuan
Help!! We’ve gotten through all hurdles except one: we’re having trouble nailing down an NPE. Specifically, we’re making VIX RunScriptInGuest calls from EJBs running in JBoss AS 5.0.1 (which itself is on a VCenter 4.1 server w/Windows 2003 Enterprise R2 64-bit). Probably just a path issue wrt VIX.dll and JNA. We’re able to make the exact call from Eclipse running on the same VCenter server — just seems to be an environment issue. Any advice on working JNA within JBoss?
Note: Since I didn’t find VIX.dll installed in VCenter, I did install VIX on the VCenter server, and append to the machine-level PATH environment variable:
C:\Program Files (x86)\VMware\VMware VIX\VSphere-4.1\32bit;C:\Program Files (x86)\VMware\VMware VIX;
** Again, can’t stress this enough: We’re able to make the exact call from Eclipse running on the same VCenter server.
In reading this note, seems like you overcame the Windows 7 issue with JNA. Is that true and if so, what was the solution? We are running into the same issue.
Windows 7 seems to also be problematic for development.
I’ve tried on 2 physical machines (Intel-based 64-bit Professional & 32-bit Enterprise), and one virtual machine running in a VSphere 4.1 environment (AMD-based 64-bit Professional) with the same results:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7701e39e, pid=1428, tid=2264
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [ntdll.dll+0x2e39e]
#
Hi Guy,
This is a known issue that I’ve been trying to figure out. I’ve traced the problem down to anything that calls VixVM_FreeBuffer() (which does get called in the example code). This works fine on a 32-bit system but triggers the JVM crash on 64-bit. I have only used Windows 7 64-bit to debug the issue, but I would guess that any 64-bit Windows system would see this problem.
This may be due to the fact that VIX only supplies a 32-bit DLL for Windows platforms. As long as you’re using a 32-bit JVM it works fine until you try to free a buffer. This makes me think it could also be a JNA issue. According to JNA, any Pointer objects that it allocates will free their memory upon garbage collection. I’m not sure how reliable that is, but one workaround I have considered is to remove the VixVm_FreeBuffer() calls. This will require some testing to make sure that JNA actually does free the memory.
I am trying to run VIX java sample on Ubuntu 10.04 with VIX API 1.10.3 installed on it and it is failing with an exception message “Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘vix’: libvix.so: cannot open shared object file: No such file or directory”
Looks like the JNA Native is not able to load the VIX library.
As stated earlier in this thread, I have a working development worksttation.
Clarification: That working system is running Windows 2003 Enterprise R2, fully patched.
I expect Windows XP would work fine, too. It’s just Windows 7 that has the ntdll problem.
Looking to see if we have a known issue with VSphere 4.1, and if so, should I be looking elsewhere for a supported java toolkit for VIX?
First time using VIX Java Toolkit in our new VSphere 4.1 architecture (running up-to-date Win2K3 64-bit for DC and VCenter, with latest VMWare-Tools and latest VIX API installed on the development workstation).
Getting NPEs when running your sample code (FindRunningVMs), specifically on:
hostHandle = new VixVSphereHandle(host, user, password);
Background: Have a Ubuntu 9.10 desktop with Eclipse, JDK 1.6, latest VIX API installed (in path), and JNA + VIXJava included as external jars.
FYI – VMRUN works great in the environment, so we’re able to rule out infrastructure issues.
UPDATE – Re-attempted from a Windows development box (vs Ubuntu) – no issues on Windows. Good to go.
So will this remain a “fling” or “labs” project, or does VMware have plans to make its Java API for VIX a first-class citizen?
You need to make sure you have VIX installed to start. Either the VIX DLL (Windows) or shared object library (Linux) must be present in your path. Hope this helps!
G
What should the title of the entry in the path be?
I am trying to run your example code from JAR but i am not able because i am getting eclipse java.lang.unsatisfiedlinkerror ‘vix’ error. I put jni path to VIX folder in program files but its still not working :/
Any ideas?