-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java example not working properly in v. 1.1.1 (in non-cmd consoles) [solved] #141
Comments
Hi. |
Ok, the example works in cmd on Windows. It doesn't work in Git Bash (MingW64 based). Java version is 1.8.0-161. I'm running the program with command
So the program runs in 32-bit mode. It's because compiling TdLib in 64-bit mode was not successful out of the box so I just went with 32-bit build. There were some problems with CMake settings (I built it as instructions said, though). Could this issue with cmd vs other consoles be added into the instructions, please? And is there some remedy for that? |
Yes, I'll add a note that on Windows the example should be run from cmd. Git bash uses mintty and mintty is incompatible with Java's System.console() used in the example. Some details about why it can't be fixed on mintty side can be found here: mintty/mintty#244. Other similar issues with mintty on Windows can be found here: mintty/mintty#56. To built 64-bit binary on Windows, you need to specify -A x64 to CMake. This possibly also needs to be added to README, despite it is entirely specific to CMake's MSVC generator. |
Hi there. Same problem here, but in this case, running the example from Eclipse's console. I can build and run the example, but it only goes up to the test of Client.execute (I think that that's the JSON output referred by @hekkup) . Then the code enters the main loop and gets blocked. I have found that it is due the System.console() command. You can't run it inside Eclipse's console, but there are some alternatives: https://stackoverflow.com/questions/104254/java-io-console-support-in-eclipse-ide I've fixed it substituting the System.console().readline() line by this snippet:
|
Using BufferedReader solves the problem. Thanks, @juananpe!
|
…dded more info about building Java example.
…dded more info about building Java example.
When you build and run the Java example in v. 1.1.1, it just prints some JSON stuff and then stops doing anything.
With some debugging I figured out the program keeps waiting for authorization in main().
By enabling the print() function in Client.UpdatesHandler.onResult() default case, the handler prints out many more JSON messages. Looks like message parsing/handling is out of date somewhere. Continuing digging...
The text was updated successfully, but these errors were encountered: