Java / COM - Building COM objects using Java classes as components
 Quick Links :

Page 1
Page 2


eFront Navigation

Web developers can use Java to make COM objects which will provide additional features to their web applications. In this tutorial we will compile a Java class and then we will register it into the system registry. Later we will access it as COM object from our web pages.

Tools of trade :

I will presume here that your operating system is Microsoft Windows. You will need a Java compiler, you can download Java Development Kit from or you can download Microsoft's SDK for Java . I will recommend Microsoft's SDK for Java since you will be needing javareg.exe tool later to register your java classes as COM components.

Writing the code :

Open your favorite notepad and write down the following Java code exactly as it is :

class ReturnText {
 public String GetText () {
 return "Hello World!" ;

You may want to copy the above code and then paste it onto your note pad. If you examine the above code, you will notice that our above Java class is pretty much straight forward with only one public method GetText, which returns a String "Hello World!". Now save this file as "".

Compiling :

Now go to the DOS prompt and compile Java class file using the command below :


A ReturnText.class file will be created if every thing goes well.

Next -> 

Copyright eFront Media, inc. Privacy Policy.