java-native-access / java-native-access/jna

Native.getComponentID always return 0 on OSX

Open
#1,082 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I created a completely new project, to test different versions of jna.
The new project only has an awt-canvas in an awt-window,:

Window window = new Window(null);
window.setBounds(100, 100, 500, 300);
window.setLayout(new BorderLayout());
				
Canvas canvas = new Canvas();
window.add(canvas, BorderLayout.CENTER);
window.setVisible(true);
				
System.out.println("window-id="+Native.getComponentID(window));
System.out.println("canvas-id="+Native.getComponentID(canvas));

And the result is:

Jna version Apple Java 1.6 Oracle Java 1.8
4.1.0 ok x (java.lang.UnsatisfiedLinkError: Can't load JAWT)
4.5.1 x id=0 x id=0
4.5.2 x id=0 x id=0
5.2.0 x id=0 x id=0

(For comparison, I also tested using 1.8)
My OSX version is 10.11.4 (15E65)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Native.getComponentID and reproduce the provided Window and Canvas example on macOS with the listed JNA and Java versions, checking the returned IDs and JAWT loading behavior. The issue names no source file or test; done means component IDs are no longer always 0 for the reported cases, with the behavior verified against the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.