Timothy E. Archer

System.out.println("Hello World!");

Browsing Posts in Java

In the Swing based java applications I write, the requirement usually exists to allow the app to open up other files such as Word Documents, PDF’s, HTML pages, etc. Since I try not to limit myself to just the file types defined in requirements gathering, I looked for a more general solution that will allow my apps to open any file type. After all, if on my Windows or Linux desktops I can double click on a file name to open the appropriate program, then why can’t my java applications?

My first take at this was to just use the java runtime, and assume my code would only run on windows 2000 or greater. The code at that point to open a file looked like this:

String cmd = "cmd /c \"" + fileName + "\"";
log.debug("Opening file with command: "+cmd);
java.lang.Runtime.getRuntime().exec(cmd);

Well, after that was in place for a few months, we wanted allow our application to also run on Linux. Uh oh, now the code above no longer works… continue reading…

One of the things I incorporate into all of my Java Swing applications is the JGoodies Look and Feel. I feel that it gives my Swing apps a much cleaner interface, especially when run under MS Windows. The applications will feel a little bit more like a standard Windows Application to the end user.

Furthermore, incorporating the JGoodies Look and Feel is EXTREMELY easy. I feel that may be it’s best feature! You can literally download the JGoodies Looks package and integrate it into your application in less that 15 minutes. I will explain how below. continue reading…

Most developers quickly realize that being notified of errors within their applications as soon as they happen is a great way to proactively fix problems. This approach has a few benefits. First, the developer does not have to spend time each day scouring logs looking for errors, and then trying to recreate the state of the system at that time to determine what happened. Secondly, the admin can actually call the end user almost immediately after being notified of the error, making them seem omniscient. Imagine being able to call your users as they are encountering the error. They will literally think you are superhuman and be amazed that you knew they needed help.

So how do we do this? Fortunately, if you are developing your application in the java programming language, most of the hard stuff is already done if you use the Apache Log4j logging framework. continue reading…

Powered by WordPress Web Design by SRS Solutions © 2012 Timothy E. Archer Design by SRS Solutions