Java FlightXML Program Error

I am using the java program that is provided. I have an api key and a username and I have used those in the code I copied and pasted. I have also complete all the necessary imports. When I run the code it prints out the first line “Print Enroute to Aircraft” and then throws the following error:

Exception in thread “main” The server sent HTTP status code 401: Authorization Required

The account with the api key I am trying to use is different from the account I am logged into now. I’m not sure what the error means, but could that cause an issue?

Thanks for your help!

401 means that the HTTP request Authorization header is not being supplied (missing entirely), so it is being rejected due to lack of credentials.

Which Java example are you using (we provide 3 variants)?

I am using the Netbeans version.

You should double check the credentials. In the Authenticator you should have something like (example credentials):
return new PasswordAuthentication(“rsonecha”, “111aaa”.toCharArray());