0

I have downloaded and initialized the pom.xml file as said in the API: https://financequotes-api.com/

While trying to run this code:

     public static void main(String[] args) throws IOException{
        Stock stock = YahooFinance.get("BABA");      
        BigDecimal price = stock.getQuote().getPrice();
        BigDecimal change = stock.getQuote().getChangeInPercent();
        BigDecimal peg = stock.getStats().getPeg();
        BigDecimal dividend = stock.getDividend().getAnnualYieldPercent();

        stock.print();  
     }

I am getting the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: 
yahoofinance/YahooFinance
   at stox.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: yahoofinance.YahooFinance
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 1 more

The yahoofinance.YahooFinance is definitely there, so I don't understand why it is failing. Can someone help me with this? Thanks!

Kevin
  • 16,549
  • 8
  • 60
  • 74

0 Answers0