Hey guys,
I'm attempting to control iTunes using Java's JNI Objects, however it doesn't seem to work correctly. I've posted the code and the error that Netbeans throws.
Any advice would be greatly appricated in terms of fixing it error.
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.DispatchEvents;
import com.jacob.com.Variant;
import java.io.IOException;
public class ITunesTest1 {
public ITunesTest1() {
ComThread.InitMTA(true);
ActiveXComponent iTunesCom = new ActiveXComponent("iTunes.Application");
Dispatch iTunesController = (Dispatch)iTunesCom.getObject();
Dispatch.call(iTunesController, "PlayPause");
ComThread.Release();
System.exit(0);
}
public static void main(String args[]) throws Exception {
ITunesTest1 test = new ITunesTest1();
}
}
When I run this code I get the follow error straight away:
>
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77024145, pid=5584, tid=5348
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
# Problematic frame:
# C [ntdll.dll+0x44145]
#
# An error report file with more information is saved as hs_err_pid5584.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Java Result: 1