The package imported by Java does not exist

I'm trying to use pdf@R_688_2419 @To write a simple PDF file, but the problem is that I received an error:

cannot find symbol class PDDocument

I have downloaded the jar file to the same folder where the program exists How to resolve this compilation error?

package org.apache.pdf@R_688_2419@.pdmodel.PDDocument;

import java.io.*;
import org.apache.pdf@R_688_2419@.pdmodel.PDDocument;

public class pdf
{
public static void main(String args[])
{
}
}

Solution

Placing jars in the same folder or package does not add them to the classpath You need to mention the path of jar in the classpath when running the Java program This is the following syntax:

compile:

javac -classpath .;yourjar.jar src/your/package/*.java

run

java -classpath .;yourjar.jar src/your/package/yourprogrammeclassname
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>