[ 
https://issues.apache.org/jira/browse/PDFBOX-2602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17334784#comment-17334784
 ] 

Jakov Vežić commented on PDFBOX-2602:
-------------------------------------

With the latest snapshot I get 
{code:java}
Exception in thread "main" picocli.CommandLine$InitializationException: Could 
not inject spec
        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: picocli.CommandLine$PicocliException: Could not get scope for field 
picocli.CommandLine$Model$CommandSpec 
org.apache.pdfbox.debugger.PDFDebugger.spec
        at picocli.CommandLine$Model$FieldBinding.set(CommandLine.java:11662)
        ... 9 more
Caused by: picocli.CommandLine$InitializationException: Could not instantiate 
class org.apache.pdfbox.debugger.PDFDebugger: 
java.lang.reflect.InvocationTargetException
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5516)
        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)
        ... 9 more
Caused by: java.lang.reflect.InvocationTargetException
        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 picocli.CommandLine$DefaultFactory.create(CommandLine.java:5491)
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5512)
        ... 12 more
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which 
requires it.
        at 
java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:208)
        at java.desktop/java.awt.Window.<init>(Window.java:548)
        at java.desktop/java.awt.Frame.<init>(Frame.java:423)
        at java.desktop/java.awt.Frame.<init>(Frame.java:388)
        at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
        at org.apache.pdfbox.debugger.PDFDebugger.<init>(PDFDebugger.java:208)
        ... 18 more

{code}
no matter which command I run.

> 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: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to