I have the following code with the iText library properly integrated.
import java.io.*;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfWriter;
@org.eclipse.jdt.annotation.NonNullByDefault(true)
public class HelloWorld {
public static final String RESULT = "C:\\Users\\administrator\\Pictures\\tuto";
@SuppressWarnings("resource")
public static void main(String[] args) throws DocumentException, IOException {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(RESULT));
document.open();
document.add(new Paragraph("Hello World!"));
document.close();
}
}
This code returns me an error message, which is as follows.
Exception in thread "main" java.io.FileNotFoundException: C:\Users\valentin.schaefer\Pictures\tuto (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at HelloWorld.main(HelloWorld.java:25)
Yet I am the computer administrator and I normally have all permissions account. I don't understand why he retourn me Access is denied
.
RESULT
is pointed at a non existent file or one that can be edited and saved. – Heartwood