Hey guys,

I've found this article showing how to manipulate itunes using java and com objects. However I dont really understand how it works, and can't seem to tell java to send a play / pause request. The event listeners works.

http://www.workingwith.me.uk/articles/java/itunes-com-with-java-and-swing

Could someone try and expand on this? Or perhaps attempt to suggest another method of controlling iTunes with java?

Thanks guys

Are you using iTunes on Windows? Did you run the example script that is suppose to get iTunes playing songs? JACOB files in the correct locations?

JACOB i couldn't get to compile and therefore found a *.jar file that was meant to be a compiled version. I'm running windows and the correct imports were located with the download jar. Ther example script threw a massive java error. Will post back when i get back home.

This is the error i get when attempting to dispatch a message to the COM Side of iTunes

#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77024145, pid=4848, tid=4392
#
# 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_pid4848.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Java Result: 1

Do you have the jacob.dll in your system32 folder? (not that that has anything to do with this error)

This is what I found with google searches:

this bug has been solved by turning off ad blocking in Norton Personal Firewall and by adding www.java.com and Sun Microsystems to the trusdted sites in the firewall

Not entirely sure what that would have to do with your error message, but its just what I found on Sun's java bug forum.

Btw, which version of Java do you have?

You can also try reinstalling the VM

Yeah its in the System32 folder. Also Norton isn't installed. In fact no firewall or antivirus is installed on that PC.

I'm using Jre : 1.6.0 and jdk 1.6.0

You may want to update to 1.6.0_04 and see if that solves the JVM crash. I assume you are running the latest JACOB build.

Ezzaral after locating the latest build of jacob from sourceforge.com it seems to have magically sprung into life :) Thanks everyone for helping with this issue

Hi
I've been working on enhancing the application that is mentioned on the website

I've got the play/pause working. I was wondering about how to go about completing the Next/Prev or maybe Shuffle functionality.
Is it as simple as

Dispatch.call(sControl,"NextTrack");
      Dispatch.call(sControl,"BackTrack");

Also, what about the events in the ITunesEvents class as stated on the website?
I would be glad if anyone would help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.