#Frequently Asked Questions
Frequently Asked Questions
Q : Can WiiuseJ send audio to the wiimote ?
A : Wiiuse doesn't support it so WiiuseJ can't support either.
Q : Why do i got this error ?
Exception in thread "Thread-0" java.lang.NoSuchMethodError: java.util.Arrays.copyOfRange([Ljava/lang/Object;II)[Ljava/lang/Object;
at wiiusej.wiiuseapievents.EventsGatherer.getEvents(EventsGatherer.java:227)
at wiiusej.WiiUseApiManager.run(WiiUseApiManager.java:415)
[INFO] Connected to wiimote [id 1].
A : So far you need java 1.6 to use WiiuseJ. Here a method from java 1.6 is missing in the java you have. I'll fix it in another release.
Q : How can i reconnect the wiimotes and find new wiimotes.
A : Shutdown WiiuseJ: WiiUseApiManager.shutdown(); and get wiimotes again : WiiUseApiManager.getWiimotes(2, true);
Q : I have this error: Error: ERROR Unable to determine bluetooth stack type. What can i do ?
A : You can try to force the type of bluetooth stack you got. This is only for windows. For this get the wiimotes this way : WiiUseApiManager.getWiimotes(2, true, WiiUseApiManager.WIIUSE_STACK_MS); if you got a windows bluetooth stack or widcomm. Use WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL if you got bluesoleil.
In regard to the NoSuchMethodError? exception...
The suspect code segments are:
// EventsGatherer.java public WiiUseApiEvent[] getEvents() { return java.util.Arrays.copyOfRange(events, 0, index); } // IREvent.java public IRSource[] getIRPoints() { return java.util.Arrays.copyOfRange(IRPoints, 0, indexPoints); }Replace with:
// EventsGatherer.java public WiiUseApiEvent[] getEvents() { WiiUseApiEvent[] ev = new WiiUseApiEvent[index]; System.arraycopy(events, 0, ev, 0, index); return ev; } // IREvent.java public IRSource[] getIRPoints() { IRSource[] ir = new IRSource[indexPoints]; System.arraycopy(IRPoints, 0, ir, 0, indexPoints); return ir; }And you'll be able to compile for JRE 1.5. You might still receive errors compiling the UI test portions, but really, all that can be commented out if you only want to use the library.
Thanks for your tip oskard. To be honest i knew this bug was coming from there and was quite easy to solve. But in fact i was too lazy and occupied to look for an elegant solution.
But finally, you gave me one and i'll make sure this correction is put in the next release. Or may be i'll do a release just for it.
Thanks for your help oskar :D
Besides the JRE 1.6 issue: Has someone already made WiiUseJ or WiiUse?, respectively, run under Mac OS X? The news page only mentions Linux and Windows... Thanks.
hello markus,
wiiuse, the C library on which wiiusej relies is not made for mac os X and as far as i know the developper is not planning to implement it. Consequently wiiusej doesn't work on mac os X ...
Look at darwin remote for a native OSX interface... or use a BT stack like BlueCove?.
Hi, I'm always getting the following warning:
WARNING? Packet ignored. This may indicate a problem (timeout is 10ms).
I guess that this has something to do with the timeout of the wiimote. So i tried to increase the timeout this way:
But I keep getting these warnings anyway. And this leads to quite big problems because there are massive delays in my application.
So can anybody help me with this? I would appreciate it :)
Dominik
I answered this question in the user discussion group.
Basically these messages come from wiiuse the C api wiiusej relies on. It is written in the ERROR? output and as far as i know there is no way to deactivate it. You can ask on the wiiuse website maybe you could get an answer.
cheers
guilhem
Two questions:
How can I disable the text output of everything? Right now, I'm running the MyClass? example, and even when every System.out.println is commented, it still displays acceleration and IR data. I disabled the motion sensing but it's activated nonetheless.
Second. I need to build a comercial product based on wiiusej. I know it's GPL, so how does the legal aspects work for this? Of course I would be providing the source code of wiiusej, but I don't want to provide my own code. Any ideas?
Thanks.
hello i'll answer you tomorrow, too late now :p
Hello saganus !
1st question : In the 1st comment you wrote. In the code provided all System.out.println are not disabled so it is normal to stil get an output(but not IR and acc data). On the other hand if the remaining ouptut are lines with "timeout" written in it, those dumps are "normal" it comes from wiiuse and not wiiusej. Those dumps are done on the std error, so redirecting your error output to something else than the screen should erase it. If you still get IR and acceleration data, make sure than netbeans recompiled everything after your changes (do a clean build for example).
For your led problem in your first post. It is all normal, when you set the led status it changes the status of the wiimote, but shutting down wiiusej doesnt change the led status of the wiimote, it only disconnects it. It is your responsibility to turn it off before sutting down.
second question: WiiuseJ is under GPLV3 so is wiiuse. Please refer to the GPLv3 to get information about making a product with wiiusej. If i am correct, if you just use wiiusej as it is, you just need to redistribute wiiusej (and wiiuse) with your program (with source code and authors). If you modify wiiusej and/or wiiuse you have to redistributethe new wiiusej/wiiuse you made. In both cases you can sell products using it. Please double check information with the GPLv3 (find official website). You can also make a donation for both projects :D
feel free to contact me if you need more information.
Thanks a lot guilhem. Your cleared me of doubts...for now.
There are already plans for donating a percentage of profits when the program is sold. Don't worry :)
Keep up the good work!
Is there a way we can change/manipulate the code you provide to make the wiimote vibrate every time we want?
what do you mean ?
sure you can. there is a method to make the wiimote vibrate. You can use it when you wish !
Hello fellows,
I have a question: Is it possible mapping wiimote buttons into keyboard keys using wiiuseJ???
Anyone knows some kind of solution to this problem without be the glovepie?
Yes you can using java.awt.Robot class.
drop me an email if you need more info ...
hi everyone... i`m trying to use wiimote but i failed T.T always get this error when i try to run the code found at SampleAppWiiuseJ project.
init: deps-jar: Compiling 1 source file to C:\Users\User\Desktop\SampleAppWiiuseJ\build\classes compile-single: run-single: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException?: 0
wiiuse v0.12 loaded. Java Result: 1the line is that: Wiimote wiimotes = WiiUseApiManager?.getWiimotes(1, true, WiiUseApiManager?.WIIUSE_STACK_MS);
and i already try this one too: Wiimote wiimotes = WiiUseApiManager?.getWiimotes(1, true);
The dlls files can be found in the root project and the .jar lib was imported i`m using win vista...miscrosoft win bluetooth stack
thx
first on your line you should get Wiimote
and here it seems the array returned is empty. wiiuse didn't find any wiimote. are you sure you connected your wiimote to windows before launching your program ?
How to use a wireless Nunchuck with the lib. It's seams to not be reconized at any input !
Regards
Hello,
as far as i know, wireless nunchuk have issues to be recognized. but this issue can only be solved at low level programming (bluetooth communication), which in wiiusej is handled by the wiiuse C API. I don't think that the author of wiiuse has solved this issue since no new version has come for a while ... Therefore i can't do anything for you :/
cheers
guilhem
Hi,
I am trying to combine the wiiusej library with the terk library for the Icreate Robot to control the Icreate robot useing the wiimote. I have loaded it all into netbeans, unfortunately I continually get the same error
C:\wii\netbeans\netbeans\src\RobotClient?\Wiicon.java:20: RobotClient?.Wiicon is not abstract and does not override abstract method onClassicControllerRemovedEvent(wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent?) in wiiusej.wiiusejevents.utils.WiimoteListener?
I get the same error after loading the sample app up in netbeans. I am still new to java and event handling therein. My overall goal is essentially to drive the icreate using the same method as the cow racing game in wii play. If anyone can shed any light on this for me I would greatly appreciate it.
ACbebop@gmail.com
Guilhem, nice work! After trying all sorts of libraries, drivers, stacks, etc., WiiuseJ worked 1st time with BlueSoleil? (v6.0.x), and WiiuseJ will integrate nicely into my Slick/LWJGL project :) Thanks, Tim.
Hey, i cant figure out how to connect my guitarhero4 controller. where are the definitions for the events?
i thank you for help.
greets fabo
To ACBebop: your error tells you that you need to override some methods. You implement the interface onClassicControllerRemovedEvent therefore you must override its method.
Netbeans should help you about that. If the sample app is not working, i guess the project was not well loaded or configured. Can you give other hints of what you did so that i can help you.
to pipemakertjm : thanks i'm glad you like it !
to frznhope:
i think you should watch the code of the sample GUI provided with of the API. In there i handle the guitar hero controller. Let me know if you need more help.
cheers guilhem
HEY, well im not an expert java programmer and it might sound like a silly question but i am unable to open the code in netbeans i have downloaded the sampleappwiiuse project and when i try opening it in netbeans it gives me an error saying wiiusej.jar file not found therefore i went and specified the wiiusej.jar file from lib folder but it still doesnt work for me... can anyone please give me step by step guide on how to open it and manipulate the source code in netbeans
thank you
Hi, I,m trying to connect the Wiimote with an Android Smartphone, the trouble is that wiiusej uses EventListenerList? from java.swing.event. So I,ve to write my own EventListenerList? and change it in wiiusej. Then, I,ve to recompile wiiusej but I don,t know how to recompile it. Can you help me? Thank you very much
Regards
PD: Your project is fantastic!
Hello david,
From what i can remember wiiusej uses swing only for the gui test. So it should be possible to remake the ajr without the gui. Moreover, it migt be complex to put wiiusej on Android. Don't forget that wiiusej relies on a C api called wiiuse. I propose on this site the wiiuse api compiled for linux. But we can't know for sure that this .so file will work on the linux Android uses. No matter what you will have to recompile wiiuse and wiiusj .so files for Arm architecture. Not a simple step. In my opinion if you want to use wiimote on android, it might be simpler to wiiuse Android Bluetooth API to reprogram a wiimote API for android. You can find the wiimote bluetooth protocol on the web. Contact me via mail if i can be of any more help.
Brgds Guilhem
how can i get the mac adress of the wiimote?