Program won't run without print statement - Java

26 Views Asked by At

I was building an application to receive input from a specific port and then move the user's cursor in response. The program works just fine, so long as I don't delete the print statement. If I do, nothing seems to run, yet there are no errors. Does anyone have any idea what is going on?

I tried experimenting with removing it and refreshing my computer and all that, but it still refused to run without the print statement.

while(true){
    System.out.println(locked); // DO NOT DELETE - CRITICAL
    if(gui.getStarted() && !locked){
        sensitivity = gui.getSens()/10.0;
        acceleration = 1 + gui.getAccel()/10.0;
        try(final DatagramSocket socket = new DatagramSocket()){
            socket.connect(InetAddress.getByName("8.8.8.8"), 10002);
            ipv4 = socket.getLocalAddress().getHostAddress();
           
        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
            port = gui.getPort();
            receiveFreelookData(ipv4, port); // IP and port can be adjusted
     }
}
0

There are 0 best solutions below