I am trying to use pdfbox to write a simple pdf file but the problem is that I am getting error :
cannot find symbol class PDDocument
I have downloaded the jar files into the same folder the program exists. How to fix this compilation error?
package org.apache.pdfbox.pdmodel.PDDocument;
import java.io.*;
import org.apache.pdfbox.pdmodel.PDDocument;
public class pdf
{
public static void main(String args[])
{
}
}
Add a Java transformation in a mapping. Add the jars in the Java Transformation under Java Code > Settings > Add Classpath to use classes from c:\sample\Myjar. jar jar file. Add the import statement that corresponds to the class file in the jar.
No, java. lang package is a default package in Java therefore, there is no need to import it explicitly. i.e. without importing you can access the classes of this package.
somethingElse the compiler assumes you are doing a packageName. classname . In this case you were intending to access out of the System class, but you could very well be trying to access a package called system that is not present (in the classpath for instance). So it is a guess from a compiler.
Putting the jar in the same folder or package does not add it to the class path. You need to mention the path of the jar in your class path while running your java program. Here is the syntax for that:
To compile:
javac -classpath .;yourjar.jar src/your/package/*.java
To run
java -classpath .;yourjar.jar src/your/package/yourprogrammeclassname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With