Popup Message boxes

javax.swing.JOptionPane Here is the code to a method I call whenever I want an information box to pop up, it hogs the screen until it is accepted: The first JOptionPane parameter (null in this example) is used to align the dialog. null causes it to center itself on the screen, however any java.awt.Component can be … Read more

I’m getting favicon.ico error

I have had this error for some time as well. It might be some kind of netbeans bug that has to do with netbeans connector. I can’t find any mention of favicon.ico in my code or in the project settings. I was able to fix it by putting the following line in the head section … Read more

Why is Netbeans suggesting I “Flip operands of the binary operators” in my Java code

Netbeans frequently suggests that I “flip operands of the binary operator” when I’m doing mathematical calculations. For example, in the following line of code: Netbeans makes the suggestion for every mathematical symbol (so it does it three times in the ‘pennies’ line. I’m not sure I understand why it’s making the suggestion. If I were … Read more

how to set default main class in java?

In the jar file you could just add this to your manifest.mft The jar file would then be executable and would call the correct main. On how to do this in Netbeans you can look at this: Producing executable jar in NetBeans

Sending mail error, javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;

Error is self explainatory: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; You have no SMTP server on localhost, but you configure it there : So you must: either configure a local SMTP server as a relay on your local system (Postfix or sendmail are two well knows servers) of configure a dummy server that simply … Read more

Undefined reference to class constructor, including .cpp file fixes

The undefined reference error indicates that the definition of a function/method (i.e constructor here) was not found by the linker. And the reason that adding the following line: fixes the issue, is it brings in the implementation as part of the main.cpp whereas your actual implementation is in StaticObject.cpp. This is an incorrect way to fix this problem. I haven’t used Netbeans … Read more