I installed sound library to use the SoundFile function, but it always run into an error called
I thought there was an error in my code, but soon I found out all functions from the sound library would have the same error. I can’t even run any of the example files.
Then I tried to install the video library, and the same thing happened. Processing cannot run any of the example files. It seems like processing is having trouble accessing functions from the library. I saw many people on the internet having the same issue but nobody solved the problem yet. All the solutions of ClassNotFoundException I found on the internet are about JAVA, does it mean I have to edit processing’s code to solve the problem?
Welcome to the forum!
In fact installing a library is not enough in order to use it.
Since Processing uses the Java programming language, you need to explicitly import them with the language.
In the Processing editor, you can use the handy tool to import a library, go to
Sketch -> Import a library -> Sound library
It will add those lines to your code:
Which imports all the classes, enums… of the sound library.
Thank you for trying to help.
I did import library. In the screenshot, it is on line 7.
and in all the example files they all imports library on the first line.
if I didn’t import library, it would be a different kind of error, such as
Cannot find a class or type named “SoundFile”
I think that there is some kind of bugs on your operating system
Oh my bad! Note that import statements should always be at the top of your source files thought
Can you try to remove and reinstall the library from the library manager? Also are you able to import and use another library?