如何将外部库添加到处理中?

时间:2019-07-16 12:54:07

标签: import processing

我无法添加外部库进行处理。

我遵循了多个教程,并研究了其他Stackoverflow问题,但没有一个能解决问题。

我已经解压缩了库并将其放入Processing内的librarys文件夹中,但是它仍然无法正常工作,我尝试使用2个不同的库,主要重点是P5irebase。

https://github.com/barneyElDinosaurio/P5ireBase

我希望示例会出现,并且还可以选择导入库,但是这些都不会出现。 “草图”按钮下方的“导入库”部分中没有贡献的库,“文件”按钮下方的库中也没有贡献库的示例。

正在处理论坛链接:https://discourse.processing.org/t/how-do-i-add-external-libraries-to-processing/12750

感谢所有帮助!谢谢:)

编辑:将P5ireBase-master更改为P5ireBase后,我得到了错误

java.io.FileNotFoundException: C:\Users\reedm\Documents\Processing\libraries\P5ireBase (Access is denied)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at processing.app.Util.copyFile(Util.java:130)
    at processing.app.Sketch.addFile(Sketch.java:1355)
    at processing.app.ui.Editor$FileDropHandler.importData(Editor.java:480)
    at javax.swing.TransferHandler$DropHandler.drop(TransferHandler.java:1544)
    at java.awt.dnd.DropTarget.drop(DropTarget.java:455)
    at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:1282)
    at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:538)
    at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:852)
    at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:776)
    at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:48)
    at java.awt.Component.dispatchEventImpl(Component.java:4744)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
    at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4609)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4471)
    at java.awt.Container.dispatchEventImpl(Container.java:2283)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:733)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

1 个答案:

答案 0 :(得分:0)

我在您的Processing论坛链接中看到,您试图将库拖放到Processing IDE中,但出现了此错误:

  

java.io.FileNotFoundException:   C:\ Users \ main \ Documents \ Processing \ libraries \ P5ireBase-master

您在“库”文件夹的末尾看到“ -master”吗?好吧,它来自GitHub,指示您下载的代码分支。突出显示会将其从文件夹名称中删除,您的库应该可以正常工作。

使用Processing,您的库文件夹必须始终与“ library”文件夹中的主.jar文件具有相同的名称。因此,在您的情况下为P5ireBase。

我希望这是唯一的问题,并且一切现在都对您适用。