I don't want to use large programs like Netbeans Eclipse and so on and should only do a small thing with pdfbox (https://pdfbox.apache.org/) but it is not working. Do I have to use maven etc?
I have downloaded pdfbox-2.0.20.jar
and pdfbox-app-2.0.20.jar
Added PATH to environment variable in Windows.
Created this (Document_Creation.java) in Notepad++
import java.io.IOException;
import org.apache.pdfbox.pdmodel.PDDocument;
public class Document_Creation {
public static void main (String args[]) throws IOException {
//Creating PDF document object
PDDocument document = new PDDocument();
//Saving the document
document.save("C:/folder/my_doc.pdf");
System.out.println("PDF created");
//Closing the document
document.close();
}
}
Open Windows CDM and type: javac Document_Creation.java
But get this error
Document_Creation.java:2: error: package org.apache.pdfbox.pdmodel does not exist
import org.apache.pdfbox.pdmodel.PDDocument;
^
Document_Creation.java:9: error: cannot find symbol
PDDocument document = new PDDocument();
^
symbol: class PDDocument
location: class Document_Creation
Document_Creation.java:9: error: cannot find symbol
PDDocument document = new PDDocument();
^
symbol: class PDDocument
location: class Document_Creation
3 errors
Looks like I can't access pdfbox with import org.apache.pdfbox.pdmodel.PDDocument;
How can I make this code work with latest java (working, tested with println without pdfbox), Notepad++ and Windows CMD?