I'm working on my first OSGi project for university and part of the task is to take user input from the console with the Java.util.Scanner. I program in eclipse using the Equinox framework. Within the project there are two bundles that use the scanner. The JUnit test of the bundle itself works just fine and the user input is processed as wished. But when I start the whole project, the following happens:
- I type in the input (an integer between 1 and 7)
- Nothing happens
- I type in the input again
- Nothing happens again
- I intentionally type in a wrong input (e.g. a String -> that should throw an exception that I want to catch and that should normally be displayed with: "Something went wrong" (this works just fine in the JUnit test))
- Instead of my own exception message, the console displays: gogo: CommandNotFoundException: Command not found: foo
- After that, when I type in the input, the program takes my input and continues as wished (this applies for correct and incorrect input).
- When the program reaches the next method in the program where a scanner is used, I find myself back at point 1.
So it seems like the input is only accepted after I made a false input which is interpreted as a gogo command. Is there any way to fix this problem? I know there are alternative ways to take user input but it is required for the task to use Java.util.Scanner
These are the active bundles in my project active bundles of the project
I tried to use the disconnect command because I thought that maybe the scanner has a lower "hierarchy" and therefore the console input is only interpreted by gogo.command but that didn't work. Removing the gogo.command plugin from the required plugins led to errors and the program didn't take input at all. Turning the auto-start for the gogo.commands plugin to false resulted in the same problem.