I have found how to read MSI files with .Net. Some of them use some libraries that come with Wix. Is there a way I read MSI data using Java. I would like to access the tables and get text values.
An .MSI is basically a database. If you can read an MS Access .MDB file with Java's JdbcOdbc driver, you can use the same code to open the .MSI instead and read it's tables.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String msiFileName= "d:/java/test.msi";
String connectString = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
connectString += msiFileName.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection( connectString ,"","");
At least in theory. :)
MSI files are COM structured storage. http://en.wikipedia.org/wiki/COM_Structured_Storage
There are a few options. You could try to access it with something like this: http://poi.apache.org/poifs/index.html
You could use JNI to access the native MSI APIs.
Or, you could shell out to something like a vbscript. The script dumps the results you want to stdout, which you then capture and parse in your java app.
Can you use Windows Installer API via Java?
The API is the only supported way of manipulating MSI files. If you're using .NET or WiX, you'll either be using these functions or functions that call these.
The binary file format of MSI is undocumented and may change between versions, so trying to read/write the binary format directly is just going to give you a real headache.