I need to capture joystick input using C or Java (whichever is easier).
There are answers to similar questions but they all use C++ or C#.
The program only needs to get the direction and amount by which the joystick is tilted.
I'm using Windows7, so I'll probably need to use winmm.dll as is explained here.
I would appreciate if someone could explain how to do so in C or Java.
There are premade libraries for both languages. The more important question would be the language you have to use or which one you'd prefer primarily. It doesn't necessarily make sense to add C code just to add such functionality to a Java program. In a similar way, you wouldn't want to call Java from C, just to get joystick input.
First hit on Google for "java joystick" has been this one. Haven't tried it yet.
As for C++ code (and most likely C# too) you should be able to use the same code in C, assuming it's pure Windows API code (cause that one is in C too). So you shouldn't have any issues adapting these.
Edit:
Regarding the answer you linked: You should be able to use this solution 1:1 in C (in Java you'd have to write code essentially doing the same). But instead of declaring everything yourself, just #include <windows.h>
and you should be ready to go (in C).