kristian / system-hook

Global Keyboard / Mouse Hook for Java applications.
MIT License
269 stars 48 forks source link

Running example code in Windows 10 works but prints errors on console #18

Closed tlaukkan closed 7 years ago

tlaukkan commented 7 years ago

It would be nice to disable these from console:

Warning: org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized. Compiler warnings: WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.' Compiler warnings: WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.' Compiler warnings: WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.' WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.' Compiler warnings: WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.'

tlaukkan commented 7 years ago

This seems to be a workaround:

compile ('lc.kra.system:system-hook:3.1') {
    exclude group: 'xerces', module: 'xercesImpl'
}
kristian commented 7 years ago

Hello Tommi, fist of all, thanks a lot for your comment. Your error really wonders me, a) because I can‘t reproduce the error on my machine and b) besides an Apache component beeing used as a build evironment (Apache Maven), there should be no other Apache dependency. The sys-hook itself doesn‘t have any dependencies.

Could you please elaborate more in detail, which commands you try to execute and which build environment you try to run the code on? Thanks.

tlaukkan commented 7 years ago

Hi

Thank you for fast response Kristian.

Just adding the dependency to a new project and adding the following line to main method causes the output when running the application:

val keyboard = GlobalKeyboardHook(true) // use false here to switch to hook instead of raw input

The compile ('lc.kra.system:system-hook:3.1') dependency adds the following dependencies to project dependency list:

lc.kra.system:system-hook:3.1 ant-contrib:cpptasks:1.0b5 ant:ant:1.6.5 xerces:xercesImpl:2.8.1 xml-apis:xml-apis:1.3.03 lc.kra.system:system-hook:3.1 ant-contrib:cpptasks:1.0b5 ant:ant:1.6.5 xerces:xercesImpl:2.8.1 xml-apis:xml-apis:1.3.03 ant-contrib:cpptasks:1.0b5 ant:ant:1.6.5 xerces:xercesImpl:2.8.1 xml-apis:xml-apis:1.3.03

-Tommi

tlaukkan commented 7 years ago

These dependencies are probably transient dependencies from the only dependency in system-hook pom.xml:

ant-contrib cpptasks 1.0b5
kristian commented 7 years ago

Hi Tommi. Hmm, you are right. By the look of it, I dislike two things about the current way the POM file looks: 1) the ant-contrib dependency barely gets maintained / can be considered unmaintained, as the last version was released 9 years ago and 2) having the ant-contrib as a simply feels wrong by now, as it is no dependency to the sys-hook library, but only used during the build time.

Let me see if I can update to a newer dependency and find another way of including it into the ant build task.

kristian commented 7 years ago

Removed dependency to cpptask and switched to much better maintained nar-maven-plugin with d556894789ffa16058d7c387c9617425055f2b36 (version 3.2). Thanks for your suggestion! 👍