Skip to content

Conversation

@bgrochowski
Copy link

Fixes the following jinput issue: jinput/jinput#325

@ennerf
Copy link
Contributor

ennerf commented Sep 9, 2025

Thanks. What platforms and matlab versions did you test the output with?

@bgrochowski
Copy link
Author

Tested with macOS 15.4.1 on M1 Pro and Matlab R2025a

@bgrochowski
Copy link
Author

Just tested on Windows 11 x64 + Matlab R2025a - the previous commit resulted in Java runtime errors. Namely, the newer Jinput version 2.0.10 (which added macOS Apple Silicon support) was compiled with release flag for JRE version 17. Update in the newest commit solves the issue by recompiling Jinput during mvn package for JRE version 8. Now it is tested working on both macOS 15.4.1 and Windows 11.

@ennerf
Copy link
Contributor

ennerf commented Sep 10, 2025

I hate when that happens. The ecosystem has largely moved beyond Java 8, but we'll need to support it for MATLAB indefinitely.

Do the native sources need to get compiled as well? If so, does CI need to setup specific compilers?

@bgrochowski
Copy link
Author

The native sources remain precompiled, only the Java classes need to be rebuilt (both "core" and platform-specific plugins).

@ennerf
Copy link
Contributor

ennerf commented Sep 12, 2025

I haven't forgotten about this, but I'd like to run my own tests on different platforms and probably won't be able to get to this until next week. Sorry for the delay.

@bgrochowski
Copy link
Author

No problem, thank you for the project and for verifying the changes! Please let me know if I can assist you with something.

<!-- Copy libjinput-osx.jnilib from natives and rename to libjinput-osx.dylib -->
<file>
<source>${project.build.directory}/natives/libjinput-osx.jnilib</source>
<outputDirectory>/matlab/lib/</outputDirectory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Causes errors on Windows

[INFO] --- assembly:3.0.0:single (make-assembly) @ input ---
[WARNING]  Parameter 'finalName' is read-only, must not be used in configuration
[INFO] Reading assembly descriptor: src/main/assembly/release.xml
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Building zip: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2.zip
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Building tar: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2.tar.gz
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Copying files to E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2
[WARNING] Assembly file: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2 is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.

change to <outputDirectory>matlab/lib/</outputDirectory> without the leading slash

@ennerf
Copy link
Contributor

ennerf commented Sep 30, 2025

When running mvn clean package on Windows 11 I get a build error

[INFO] --- assembly:3.0.0:single (make-assembly) @ input ---
[WARNING]  Parameter 'finalName' is read-only, must not be used in configuration
[INFO] Reading assembly descriptor: src/main/assembly/release.xml
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Building zip: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2.zip
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Building tar: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2.tar.gz
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /matlab/lib/
[INFO] Copying files to E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2
[WARNING] Assembly file: E:\HEBI\MatlabInput-fork\target\matlab-input-1.2.2 is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.

after fixing that I get a class not found error on the JInput classes when running kb = HebiKeyboard

java.lang.ClassNotFoundException: net.java.games.input.AWTKeyboard
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at com.mathworks.jmi.CustomURLClassLoader.findClass(ClassLoaderManager.java:760)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at us.hebi.matlab.input.JInputUtils.createAWTKeyboard(JInputUtils.java:269)
	at us.hebi.matlab.input.HebiKeyboard.<init>(HebiKeyboard.java:21)

I don't have a physical joystick here at the moment, so I can't test that part.

@bgrochowski
Copy link
Author

Apologies for the late response. The newest commit solves this problem; apparently, the newer version of jinput requires including awt-plugin dependency explicitly in the pom.xml file. Now, both HebiKeyboard and HebiJoystick appear to work correctly. Tested on Windows 11 x64 + Matlab R2025a, I will run another test on macOS this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants