# Copyinh GLFW keyboard and mouse input from Java in LWJGL to C/C++ GLFW

**URL:** https://discourse.glfw.org/t/copyinh-glfw-keyboard-and-mouse-input-from-java-in-lwjgl-to-c-c-glfw/1546
**Category:** support
**Created:** [April 24, 2020, 3:48am UTC](https://discourse.glfw.org/t/copyinh-glfw-keyboard-and-mouse-input-from-java-in-lwjgl-to-c-c-glfw/1546 "2020-04-24T03:48:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![johnratius](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/johnratius/32/384_2.png) [@johnratius](https://discourse.glfw.org/u/johnratius)
#### Post date: [April 24, 2020, 3:48am UTC](https://discourse.glfw.org/t/copyinh-glfw-keyboard-and-mouse-input-from-java-in-lwjgl-to-c-c-glfw/1546/1 "2020-04-24T03:48:17Z")

</div>

I am at this part of [this tutorial](https://youtu.be/2ZbmO8K-x2s?t=222), and I am stuck translating the code to C/C++.

In the tutorial:  
public class Input {  
private GLFWKeyCallback keyboard;  
private GLFWCursorPosCallback mouseMove;  
…  
}

I try to translate it to C/C++ GLFW code, but the above types do not exist.  
So I tried it with some other types I found with no success. (`GLFWkeyfun`, and `GLFWcursorposfun`).

Were these types removed? The tutorial isn’t even a year old yet. I am not sure if Java has different types, or if it has something to do with the other packages that come with LWJGL. I tried googling for more examples or references of how to implement input for GLFW, but didn’t find anything useful. My code compiles with no errors without the Input class, but with it, I get errors where `GLFWKeyCallback` does not exist.

Any suggestions?

(I am using the latest version of GLFW, with the latest version of GLAD. Both were installed today, and I am compiling on Windows 10 x64 using MinGWx64 that came with MSys2 with CLion).  
(GLFW and GLAD are installed in the project level, not in MinGW)

---

<div class="post-metadata">

### Author: ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)
#### Post date: [April 24, 2020, 8:54am UTC](https://discourse.glfw.org/t/copyinh-glfw-keyboard-and-mouse-input-from-java-in-lwjgl-to-c-c-glfw/1546/2 "2020-04-24T08:54:11Z")

</div>

Your problems are due to Java being substantially different from C and C++. You should look for a C or C++ tutorial and also read the documentation, for example the [GLFW input documentation](https://www.glfw.org/docs/latest/input_guide.html#input_keyboard) has an example of how to set up a key callback.

Additionally GLFW has a set of examples and test code. The test `events.c` shows how to register callbacks for all events:

> <https://github.com/glfw/glfw/blob/master/tests/events.c#L625-L640>
