简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM