Late reply I know, I guess you've moved on by now (I missed this post or it was too complex to respond to when I saw it), but did you get any further with this?
First I would say, don't call stage.showAndWait(), just call show(). JavaDoc should help clear up why:
https://docs.oracle.com/javase/8/javafx/api/javafx/stage/Stage.html#showAndWait
The double while(true) loops are not a great idea - I don't think you want the outer while loop at all. And your fileInputStream.close() method never gets called at the end, which is bad - after the
return "Ok";, the method is left entirely.
For the inner loop you can do this instead, this is using something called a try-with-resources:
I would call the second class BarCodeReadingService (or at least something that's a noun instead of a verb type name) and refactor things so that all JavaFX stuff like TableView/TableColumn/Button/BorderPane/VBox etc. are in a method (displayCode() or something) in the "Main" class. Then that method would call the service class to read the barcode. The "service" class would focus ONLY on the barcode/USB concerns, to keep that decoupled from your UI code (that could be a conversation in itself but I'll just say it's considered a good practice, and that would make it independently testable without a UI being involved). The 'service' method would just have the stuff I pasted refactored above.
Last thing, you don't want to have potentially never ending loops or anything that might take a long time to execute run on the JavaFX
thread, because that thread does rendering and updates for the UI itself. If it's locked in a never-ending loop or a very slow method, it never gets a chance to update the UI view, so it'll appear to "freeze".