Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试使用com4j将艺术品从文件添加到iTunes IITrack对象时出现灾难性错误_Java_Com_Itunes_Com4j - Fatal编程技术网

Java 尝试使用com4j将艺术品从文件添加到iTunes IITrack对象时出现灾难性错误

Java 尝试使用com4j将艺术品从文件添加到iTunes IITrack对象时出现灾难性错误,java,com,itunes,com4j,Java,Com,Itunes,Com4j,在iTunes中使用Com4j,向IITrack对象添加各种文本值没有问题,但如果我尝试使用 if(iTunesTrack.artwork().count()==0) { String path = new File(new File(song.getFilename()).getParent(),"folder.jpg").getPath(); if(Files.exists(Paths.get(path))) { iTunesTrack.addArtworkFromF

在iTunes中使用Com4j,向IITrack对象添加各种文本值没有问题,但如果我尝试使用

if(iTunesTrack.artwork().count()==0)
{
  String path = new File(new File(song.getFilename()).getParent(),"folder.jpg").getPath();
  if(Files.exists(Paths.get(path)))
  {
      iTunesTrack.addArtworkFromFile(path);
  }
}
它失败了

2017年5月11日18.24.56:BST:com.jthink.songkong.ituneshelper.WindowsUpdateTuneSwithChanges:UpdateTuneSlibtTrackFrom歌曲:严重:无法更新ItunesTrack C:\Users\Paul\Desktop\TestMusic\WAV\Music\Choir of Trinity College\Carlos From Trinity\27-在Dulci Jubilo(风琴独奏)。WAV:8000ffff灾难性故障:灾难性故障 com4j.ComException:8000ffff灾难性故障:灾难性故障:。\invoke.cpp:517 在com4j.Wrapper.invoke(Wrapper.java:187) 位于com.sun.proxy.$Proxy57.addArtworkFromFile(未知源) 在com.jthink.songkong.ituneshelper.WindowsUpdateTuneSwithChanges.UpdateTuneSlibtTrackFromSong(WindowsUpdateTuneSwithChanges.java:611) 在com.jthink.songkong.ituneshelper.WindowsUpdateTuneSwithChanges.AddedItemTrack(WindowsUpdateTuneSwithChanges.java:646) 在com.jthink.songkong.ituneshelper.WindowsUpdateTunesWithChanges.analyseFiles(WindowsUpdateTunesWithChanges.java:277) 在com.jthink.songkong.ituneshelper.WindowsUpdateTuneSwithChanges.UpdateTunes(WindowsUpdateTuneSwithChanges.java:180) 在com.jthink.songkong.ituneshelper.updateItemSwithChanges.call(updateItemUserSwithChanges.java:182) 在com.jthink.songkong.ituneshelper.updateItemSwithChanges.call(updateItemUserSwithChanges.java:32) 位于java.util.concurrent.FutureTask.run(未知源) 位于java.util.concurrent.ThreadPoolExecutor.runWorker(未知源) 位于java.util.concurrent.ThreadPoolExecutor$Worker.run(未知源) 位于java.lang.Thread.run(未知源) 原因:com4j.ComException:8000ffff灾难性故障:灾难性故障:。\invoke.cpp:517 在com4j.Native.invoke(本机方法) 在com4j.StandardComMethod.invoke(StandardComMethod.java:35) 在com4j.Wrapper$InvocationThunk.call(Wrapper.java:356) 在com4j.Task.invoke(Task.java:50) 在com4j.ComThread.run0(ComThread.java:172) 在com4j.ComThread.run处(ComThread.java:153)


COM4j接口是从我的iTunes版本中构建的,所以它们是存在的,我不知道我是否做错了什么,或者它是否坏了,我已经在许多JPOG上进行了尝试,都得到了相同的结果。我检查文件是否存在,如果尝试添加不存在的文件,则错误确实不同。

您确定这不是路径问题吗?您使用的是绝对路径吗?这对这个家伙来说似乎还可以:(C#也使用了COM iTunes库,E#u FAIL返回代码是“灾难性的失败”)。是的,我认为字符串路径=新文件(新文件(song.getFilename()).getParent(),“folder.jpg”).getPath();我不熟悉Java,所以我不确定,但这是COM端出现问题的标准原因。