Developer

Troubleshooting Java

On April 6th Jason Baldwin eased our eebie-jeebies, with his quick tricks and know-how on trouble shooting Java.


On April 6th Jason Baldwin soothed our eebie-jeebies, with his quick tricks and know-how on troubleshooting Java.If you couldn’t join us then, enjoy the transcript and we hope to see you on our next live Guild Meeting.

Note: TechProGuild edits Guild Meeting transcripts for clarity.

Welcome to the Guild Meeting!
MODERATOR: Welcome to tonight's meeting! Tonight, TechRepublic's own Java Expert Extraordinaire, Jason Baldwin, is here to offer advice for troubleshooting your pesky Java problems. Tonight's chattiest member will receive a copy of O'Reilly's Windows 2000 Active Directory. Jason, would you like to introduce yourself to the members?

JASON BALDWIN: Thanks, Miss Moderator. As she said, I'm Jason Baldwin, one of the Web development engineers here at TechRepublic. I've been with the company since almost the beginning, and have run into more than my share of Java bugs. Tonight, I'll go into a few ways to reduce the number of bugs you hit, as well as talk about some of the ways you overcome them once encountered

MODERATOR: Who has tonight's first question for Jason?

JASON BALDWIN: If there are no questions at the beginning, I can just start talking. Feel free to interrupt, and I'll do my best to field any questions

ASLAN: Good evening, Jason. I am new to Web development and would like to know what I would use Java for on a new site.

JASON BALDWIN: I'll primarily be dealing with server side java, as we don't have a ton of use for applets and the GUI elements in Java. Well, Java has a variety of uses on the server, in addition to the cute little applets that roam the Web, modifying pictures to make ripples or other tricks. One of the best uses, however, is to add all the logic of a desktop application to your Web site.

ASLAN: What type of applications?

JASON BALDWIN: You can do anything with a servlet that can be done with a CGI script, ASP, or PHP.

A few favorites
ASLAN: What servlets are your favorites or do you use the most

JASON BALDWIN: Anything from the handling of forms, to an application that can do your taxes. Java is a fully functional programming language similar to C++ in its operation.

JASON BALDWIN: Well, everything on TechRepublic and TechProGuild is done with a servlet, from initial profile creation to the forums, which are currently being rewritten.

ASLAN: Is it fairly logical in it's programming. Or like me try to understand Greek

JASON BALDWIN: It's quite logical. A lot of the most difficult aspects of C++ have been automated for you. If you can understand and read JavaScript, you should be able to learn Java from a book or a simple class.

TRA: What benefits does java provide over something like ASP or XML?

ASLAN: I'll go for simple. Do you have some favorite books/references for Java learning?

JASON BALDWIN: It's a lot close to ASP than XML, Java servlets are platform independent, so if you're running in a UNIX environment you don't have to run a middleware interpreter.

ASLAN: For a beginner of course!

JASON BALDWIN: Well, the Web is as good a resource as you will find in any book, from Sun's Java API documentation, to tutorials on sites like Javaworld and Javaboutique. The CORE series is a good set of books if you prefer something in a hardcopy. Additionally, you can find a Java class in most colleges that have any Computer Science program at all.

HAROLD66: I don’t know anything about JAVA...Are there different flavors of JAVA??

The different sides of Java
ASLAN: Thanks. I think I will check out the Web documentation first to see if I even have any aptitude for programming in Java. Ha!

JASON BALDWIN: There used to be two distinct flavors of Java, Sun's Java and Microsoft’s J++, but I am pretty sure that J++ has gone the way of the Dodo. There were licensing issues with it, I believe, and it's been locked up in court.

ASLAN: Not quite, I don't think the Dodo had a choice in its extension!

JASON BALDWIN: There are several of varieties of Java use, though. A lot of what you saw a year or two ago were the applets that would download to the browser and operate on the client's machine.

HAROLD66: Can I use JAVA in any browser...? NETSCAPE...IE...etc??? I mean SUN'S JAVA

ASLAN: And across operating systems, I have read.

JASON BALDWIN: Client-side Java is SUPPOSED to work anywhere, but a lot is dependent on the programmer's choice in what classes to use. The real problem comes in that there are multiple Virtual Machines, which run the compiled code. Server side will work anywhere, because you can test it in your environment, and make sure it will do what it promises.

ASLAN: Is that part of the problems you have run into using Java?

TRA: How does server side java use the virtual machine of the user?

JASON BALDWIN: Well, I've primarily worked on servlets, so I've been able to avoid worries about what the user may be running. A Java application is partially compiled, into what is called a byte code. That is what is fed to the VM, which interprets the code and runs the application. That's why it's slower than C++ but faster than JavaScript or VB.

What about resource usage?
ASLAN: How is it on resource usage on the server and then on the client side?

JASON BALDWIN: I missed a question up there; the Server side java doesn't use the User's VM at all, but runs on the Server's. On the client-side, it acts no differently than HTML, because HTML is what a servlet spits out. On the server side, it'll run very well, depending on what you do with it. That reminds me of another benefit of Java servlets over ASP or another application environment. You can use as little or as much of it as you want, and you don't have a lot of overhead if you only plan on using small pieces of Java.

MODERATOR: Great questions so far, everyone! Who's next? Norris, I don't think we've heard from you!

ASLAN: Jason, what were the bugs and fixes you were going to tell us about at the beginning of the chat?

NORRIS: What do you think of the Enterprise Java Bean craze?

JASON BALDWIN: Ok, here we go... I'll get to Norris' question in a moment, the most common bugs are results of simple typos, and can be avoided with a few practices when coding.

NORRIS: How would I use java to build a B2B site?
Our Guild Meetings feature top-flight professionals leading discussions on interesting and valuable IT issues. You can find a schedule of Guild Meetings in your weekly, or on the Guild Meeting calendar.
ASLAN: There is a term I am not familiar with. What is B2B?

JASON BALDWIN: The best way to avoid them is to develop a standard that you code to, where you name your classes and variables with a method, helping to cut out confusion.

NORRIS: B2B = Business to Business (e.g. e-commerce).

ASLAN: Thanks, Norris!

JASON BALDWIN: It's also invaluable to have someone else review what you write, because you will often miss glaring typos in your own work that someone else will catch right off!

ASLAN: How true, how true!

JASON BALDWIN: Okay, to Answer Norris' first Q... Enterprise Java Beans promise a strong performance boost and a big reduction in duplication of work across a multiple-server enterprise. By pooling session objects, it lessens garbage collection hassles by an order of magnitude. And by using Remote Method Invocation, it allows you to distribute the processing and make sure each bean only does its job. Sort of amplifying the object-orientation of Java. Of course, EJB is still new, and has yet to fulfill all of its promises, IMO.

ASLAN: Have you tried it out yourself, Jason?

JASON BALDWIN: As far as B2B, aside from being the buzzword of the day, it is a good idea for office supply companies and other organizations that cater to making other businesses work. I haven't done a great deal with EJB, but some of the other developers here have worked with it fairly extensively. I've done some EJB code review, but we haven't implemented anything using it here yet. We are working on using parts of EJB to speed the site up, though most of our problems have been related to our ISP... Am I allowed to say that in public? I guess I am. :)

HAROLD66: GOOD night...thank you.

An increased use of Java
JASON BALDWIN: We have somewhere around 20 servers co-located, and EJB will simplify the process of deploying new features, since they'll only live in one place. Night, Harold!

ASLAN: Do you see an increase in the use of Java or its "off spring" in the future of the Web or is there something else on the horizon?

JASON BALDWIN: Well, I personally don't think there's ONE future of the Web, but Java servlets definitely have their place here at TechRepublic, and more sites are built with them every day. I think it's a lot more fun to write than Perl, Python, or TCL.

ASLAN: Well, that would have my vote then. I could use more fun in my work.

JASON BALDWIN: Servlets have allowed us to do a lot of things that would have been unruly with other technologies, and make improving the features we have a lot easier, since it's truly object-oriented.

SSONES: I know this probably isn't possible, but can a program written in Java directly access the parallel or serial ports?

JASON BALDWIN: I don't think so. Java is supposed to be platform independent, and there are no guarantees that you'll find either port there. There are probably ways to access it using some extended Java APIs, but it won't pass the toaster test. (Will it run on a Java toaster?)

Almost time to go!!!
MODERATOR: 5 minute warning, folks. In a moment, I'll announce tonight's winner!

SSONES: So, is it possible with Java using inline coding with assembly? (Thanks.)

ASLAN: Are there "boilder-plate" Java servlets available on the Web for use (and study) for newbies like me :)

JASON BALDWIN: Isn't Assembly dependent on platform? Yes, there is a wealth of example and tutorial material out there. A good place to start is servlet.com. I'm sorry, servlets.com

ASLAN: If I remember back that far, I think assembly iis machine code rather than OS. Thanks Jason. Have to watch those typos, eh? hehehe.

JASON BALDWIN: It's not so much OS dependent as true platform, yes? As in X86 assembler would be different than 68K Apple. Indeed.

ASLAN: Oh, that could be for sure.

JASON BALDWIN: In any case, I don't know a whole lot of assembly language, but if you don't mind targeting a specific platform you could do it. But in that case, there are better ways; such as using some of the APIs you can add to your Compiler that can hit specific windows functions (or likely other plats). Or even tying Java in with C++.

MODERATOR: Thanks everyone for stopping by tonight's meeting! Great questions from everybody! Tonight's big winner of the O'Reilly Windows 2000 Active Directory book is...

Thanks Everyone
ASLAN: Well, thanks Jason for the info tonight. I think I will venture to some of sites recommended!

MODERATOR: ASLAN!

JASON BALDWIN: Cool. Another site to check out would be Javasoft.com. They have a lot of good stuff there.

ASLAN: Great! Thanks for the book.

MODERATOR: ASLAN, please e-mail your name, snail-mail address, and phone number to hmorris@techrepublic.com

ASLAN: Okay!

MODERATOR: Don't forget to tune in tomorrow at 2:00 P.M. EDT for an open discussion on infrastructure. Thanks again to our speaker tonight... great job!

JASON BALDWIN: Good night, everybody!

MEMBER1: Jason you rock!
Our Guild Meetings feature top-flight professionals leading discussions on interesting and valuable IT issues. You can find a schedule of Guild Meetings in your weekly TechProGuild Notes TechMail, or on the Guild Meeting calendar.

Editor's Picks

Free Newsletters, In your Inbox