Search code examples
eclipseimportyamlclassnotfoundexceptionsnakeyaml

SnakeYAML class not found error?


I'm writing a small java program that needs to use SnakeYAML, and it works fine when running it from within Eclipse, but when I export it, it can't seem to locate the SnakeYAML class to handle the Yaml object, like in the Yaml yaml = new Yaml(); declaration.

I imported the snakeYAML Jar library as an external Jar, which I suspect may cause it not to compile the library with it, how do I fix this?

In particular, this is the error line referring to what I'm talking about whilst launching it outside of Eclipse:

java.lang.ClassNotFoundException: org.yaml.snakeyaml.Yaml

As I side note, I'm typically accustomed to writing Minecraft bukkit plugins, hence they way I import the Bukkit libraries is how I imported the SnakeYAML libraries.


Solution

  • You have to export a runnable-JAR file, that should fix your issue. Rightclick project -> Export... -> "Runnable JAR file" -> Choose your project -> Finish