kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.75k stars 347 forks source link

Question #471

Closed Skieransa closed 1 month ago

Skieransa commented 1 month ago

Hello i have a question is there a way to change where the JNativeHook.x86_64.dll file is generated when the file is ran?

kwhat commented 1 month ago

Lot of questions about this recently, please see https://github.com/kwhat/jnativehook/issues/467.

kwhat commented 1 month ago

To add just a little more to my previous answer, you can set the jnativehook.lib.path property: https://github.com/kwhat/jnativehook/blob/2.2/src/main/java/com/github/kwhat/jnativehook/DefaultLibraryLocator.java#L81

Skieransa commented 1 month ago

thanks but how do i make it into the jar file when im done editing the code?

kwhat commented 1 month ago

thanks but how do i make it into the jar file when im done editing the code?

I guess I don't quite follow what you are trying to accomplish.

Skieransa commented 1 month ago
  1. I am modifying the java code specifically i am modifying https://github.com/kwhat/jnativehook/blob/2.2/src/main/java/com/github/kwhat/jnativehook/DefaultLibraryLocator.java#L81
  2. I do not understand how to use it ( i am talking about the github actions)
  3. got it
Skieransa commented 1 month ago

Also the thing im trying to accomplish is to try to have it generate the dll file somewhere else

Skieransa commented 1 month ago

I somewhat understand how to use github actions now but when it tries to compile java it givse me this error Error: This request has been automatically failed because it uses a deprecated version of actions/upload-artifact: v2. Learn more: https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/ I saw that it has a new version of v4 but i do not know where to change it to that

I found out how to do it ( Im sorry for being stupid)

Skieransa commented 1 month ago

thanks but how do i make it into the jar file when im done editing the code?

I guess I don't quite follow what you are trying to accomplish.

  • What code are you modifying? The Java code or the C code?
  • The entire build process happens in GitHub Actions in a two step process that starts by compiling the C code with cmake and then the Java code with maven.
  • The native files are just added to specific folders in the Jar archive.

so i set the artifact versions to v4 but when it tries to compile it gives me this on the upload part

0s

[debug]Evaluating condition for step: 'Upload'

[debug]Evaluating: success()

[debug]Evaluating success:

[debug]=> true

[debug]Result: true

[debug]Starting: Upload

[debug]Loading inputs

[debug]Evaluating: format('{0}/src/main/resources

[debug]', github.workspace)

[debug]Evaluating format:

[debug]..Evaluating String:

[debug]..=> '{0}/src/main/resources

[debug]'

[debug]..Evaluating Index:

[debug]....Evaluating github:

[debug]....=> Object

[debug]....Evaluating String:

[debug]....=> 'workspace'

[debug]..=> 'D:\a\jnativehook\jnativehook'

[debug]=> 'D:\a\jnativehook\jnativehook/src/main/resources

[debug]'

[debug]Result: 'D:\a\jnativehook\jnativehook/src/main/resources

[debug]'

[debug]Loading env

Run actions/upload-artifact@v4

[debug]followSymbolicLinks 'true'

[debug]implicitDescendants 'true'

[debug]omitBrokenSymbolicLinks 'true'

[debug]excludeHiddenFiles 'true'

[debug]followSymbolicLinks 'true'

[debug]implicitDescendants 'true'

[debug]matchDirectories 'true'

[debug]omitBrokenSymbolicLinks 'true'

[debug]excludeHiddenFiles 'true'

[debug]Search path 'D:\a\jnativehook\jnativehook\src\main\resources'

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat\jnativehook from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat\jnativehook\lib from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat\jnativehook\lib\windows from rawSearchResults because it is a directory

[debug]Removing D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat\jnativehook\lib\windows\x86_64 from rawSearchResults because it is a directory

[debug]File:D:\a\jnativehook\jnativehook\src\main\resources\com\github\kwhat\jnativehook\lib\windows\x86_64\JNativeHook.dll was found using the provided searchPath

With the provided path, there will be 1 file uploaded

[debug]Root artifact directory is D:\a\jnativehook\jnativehook\src\main\resources

Artifact name is valid! Root directory input is valid!

[debug]Workflow Run Backend ID: b71ec3e7-5d63-42d4-a906-b5aefa5547e1

[debug]Workflow Job Run Backend ID: 22f90a54-96f3-5c92-7856-e0c70c3d20f1

[debug][Request] CreateArtifact https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact

[debug][Response] - 409

[debug]Headers: {

[debug] "content-length": "95",

[debug] "content-type": "application/json",

[debug] "date": "Wed, 02 Oct 2024 21:32:03 GMT",

[debug] "x-github-backend": "Kubernetes",

[debug] "x-github-request-id": "E801:A20FD:DEC712:11533B0:66FDBBD3"

[debug]}

[debug]Body: {

[debug] "code": "already_exists",

[debug] "msg": "an artifact with this name already exists on the workflow run"

[debug]}

Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

[debug]Node Action run completed with exit code 1

[debug]Finishing: Upload

kwhat commented 1 month ago
  1. I am modifying the java code specifically i am modifying https://github.com/kwhat/jnativehook/blob/2.2/src/main/java/com/github/kwhat/jnativehook/DefaultLibraryLocator.java#L81

Also the thing im trying to accomplish is to try to have it generate the dll file somewhere else

Ok, you don't need to modify that code. jnativehook.lib.path is just a java property. Just run your program with java -Djnativehook.lib.path=C:/Some/Path/ where C:/Some/Path/ is where you want the libraries to be extracted to.

Skieransa commented 1 month ago
  1. I am modifying the java code specifically i am modifying https://github.com/kwhat/jnativehook/blob/2.2/src/main/java/com/github/kwhat/jnativehook/DefaultLibraryLocator.java#L81

Also the thing im trying to accomplish is to try to have it generate the dll file somewhere else

Ok, you don't need to modify that code. jnativehook.lib.path is just a java property. Just run your program with java -Djnativehook.lib.path=C:/Some/Path/ where C:/Some/Path/ is where you want the libraries to be extracted to.

Oh. well that helps alot

Skieransa commented 1 month ago
  1. I am modifying the java code specifically i am modifying https://github.com/kwhat/jnativehook/blob/2.2/src/main/java/com/github/kwhat/jnativehook/DefaultLibraryLocator.java#L81

Also the thing im trying to accomplish is to try to have it generate the dll file somewhere else

Ok, you don't need to modify that code. jnativehook.lib.path is just a java property. Just run your program with java -Djnativehook.lib.path=C:/Some/Path/ where C:/Some/Path/ is where you want the libraries to be extracted to.

But where do i add that? found out

Skieransa commented 1 month ago

thanks alot