you need to have an instance of the call back that isn;t garbage collectable. To do this you need to store an instance of the call back at all times. In the example below you'll notice anonymous inner classes are not used.
private final GLFWCharCallback charCallback;
charCallback = new GLFWCharCallback()
{
@Override
public void invoke(long window, int codepoint)
{
// do key processing
}
};
// create window
long window = -1;
...your code here to create the window
GLFW.glfwSetCharCallback(window, charCallback);