[
https://issues.apache.org/jira/browse/PDFBOX-2602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17333473#comment-17333473
]
Jakov Vežić commented on PDFBOX-2602:
-------------------------------------
I'm getting all sorts of exceptions running PDFBox on Debian 10 (Digital
Ocean), can't even run a single command. 3.0.0-RC1.
Just running
{code:java}
java -jar pdfbox-app-3.0.0-RC1.jar -help
{code}
gives the following:
{code:java}
Exception in thread "main" java.lang.ExceptionInInitializerError
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5486)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5512)
at
picocli.CommandLine$Model$CommandUserObject.getInstance(CommandLine.java:11813)
at
picocli.CommandLine$Model$CommandUserObject.get(CommandLine.java:11838)
at picocli.CommandLine$Model$FieldBinding.set(CommandLine.java:11661)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedTypedMembers(CommandLine.java:11532)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedFields(CommandLine.java:11466)
at
picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:11399)
at
picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:6202)
at picocli.CommandLine.<init>(CommandLine.java:227)
at picocli.CommandLine.toCommandLine(CommandLine.java:3517)
at picocli.CommandLine.addSubcommand(CommandLine.java:373)
at picocli.CommandLine.addSubcommand(CommandLine.java:354)
at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:51)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which
requires it.
at
java.desktop/sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:135)
at org.apache.pdfbox.debugger.PDFDebugger.<clinit>(PDFDebugger.java:154)
... 19 more
{code}
If I do what's recommended here
([https://stackoverflow.com/questions/662421/no-x11-display-variable-what-does-it-mean)]
I get:
{code:java}
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window
server using ':0.0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native
Method)
at
java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at
java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at
java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at
java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:231)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at org.apache.pdfbox.debugger.PDFDebugger.<clinit>(PDFDebugger.java:154)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5486)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5512)
at
picocli.CommandLine$Model$CommandUserObject.getInstance(CommandLine.java:11813)
at
picocli.CommandLine$Model$CommandUserObject.get(CommandLine.java:11838)
at picocli.CommandLine$Model$FieldBinding.set(CommandLine.java:11661)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedTypedMembers(CommandLine.java:11532)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedFields(CommandLine.java:11466)
at
picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:11399)
at
picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:6202)
at picocli.CommandLine.<init>(CommandLine.java:227)
at picocli.CommandLine.toCommandLine(CommandLine.java:3517)
at picocli.CommandLine.addSubcommand(CommandLine.java:373)
at picocli.CommandLine.addSubcommand(CommandLine.java:354)
at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:51)
{code}
If I do
{code:java}
java -Djava.awt.headless=true -jar pdfbox-app-3.0.0-RC1.jar pdfbox -help
{code}
I get
{code:java}
Exception in thread "main" java.lang.ExceptionInInitializerError
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5486)
at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5512)
at
picocli.CommandLine$Model$CommandUserObject.getInstance(CommandLine.java:11813)
at
picocli.CommandLine$Model$CommandUserObject.get(CommandLine.java:11838)
at picocli.CommandLine$Model$FieldBinding.set(CommandLine.java:11661)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedTypedMembers(CommandLine.java:11532)
at
picocli.CommandLine$Model$CommandReflection.initFromAnnotatedFields(CommandLine.java:11466)
at
picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:11399)
at
picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:6202)
at picocli.CommandLine.<init>(CommandLine.java:227)
at picocli.CommandLine.toCommandLine(CommandLine.java:3517)
at picocli.CommandLine.addSubcommand(CommandLine.java:373)
at picocli.CommandLine.addSubcommand(CommandLine.java:354)
at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:51)
Caused by: java.awt.HeadlessException
at
java.desktop/sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:135)
at org.apache.pdfbox.debugger.PDFDebugger.<clinit>(PDFDebugger.java:154)
... 19 more
{code}
> Enhance command line tools
> --------------------------
>
> Key: PDFBOX-2602
> URL: https://issues.apache.org/jira/browse/PDFBOX-2602
> Project: PDFBox
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.8.8, 2.0.0
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Minor
> Fix For: 3.0.0 PDFBox
>
>
> The command line tools shall be enhanced to have the same behavior across all
> tools.
> From the discussion on the dev mailing list
> - add an -h option to print the usage
> - print the usage to System.err and use an exit code of 1 if there was an
> invalid command line parameter
> - print messages on exceptions to System.err
> - rethrow the exception so java can handle it if it will terminate afterwards
> anyway
> - use an exit code of 1if rethrowing doesn't make sense
> Additional input:
> https://clig.dev/
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]