O'Reilly logo

Essential SNMP, 2nd Edition by Kevin Schmidt, Douglas Mauro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Java and SNMP

So far, we have shown how to use Perl scripts to perform SNMP tasks. In this chapter, we will show how to use Java to create SNMP applications. Java is not widely used in system and network administration circles, but there are those who have made the leap from scripting language to object-oriented language. While Java is an object-oriented language, you don't have to be an object guru to use Java.

Java has similar advantages to Perl. It's platform independent with built-in support for network sockets and threading. One advantage that Java has over Perl is that it can outperform Perl for certain types of tasks. Perl is commonly regarded as being well suited for processing text since its regular expression handling is very good. Java also has regular expression support and can generally outperform Perl in this regard. Java also has the advantage of the HotSpot compiler. HotSpot allows for a long-running Java program to be self-optimized over time. This is something that traditional compiled languages like C and C++ do not have and is also not found in Perl. Another advantage to Java is that creating multithreaded applications is very easy.

SNMP4J

The SNMP API presented in this chapter is SNMP4J. The current version is 1.5 and it works with Java 1.4.1 or later. It is released for free under the Apache software license. You can obtain a copy of SNMP4J from http://www.snmp4j.org. The library's design is patterned after the successful SNMP++ C++ library whose early ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required