Question

I need to be able to perform calculations on numbers that extend to very many decimal places. I am using the BigDecimal class, but I need to be able to take logarithms of these BigDecimals and I also need Euler's number to many decimal places. I am attempting to import the org.nevec.rjm package in Java, as this appears to suit my needs. My import statement is:

import org.nevec.rjm.*;

But when I attempt to compile I get an error message that says the org.nevec package does not exist.

This has been a source of frustration for me for a little while now and I cannot seem to find the solution anywhere. Any help would be much appreciated!

Était-ce utile?

La solution

The compiler and the JVM can't magically find the classes you need just because you add an import to your source code. You have to download the library (jar file) containing this class and all its dependencies, and add this jar to the classpath when compiling and running your code:

javac -cp theJar.jar com/foo/bar/YourClass.java
java -cp theJar.jar:. com.foo.bar.YourClass
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top