< Back To ASN1C Support

ASN1C Java Tutorial

Getting Started with the ASN1C Java command line

This tutorial will help you use ASN1C Java from within a Windows command terminal window. All steps before and including compiling using the ASN1C compiler can also be accomplished using the Graphical User Interface Wizard.

Open a Visual Studio terminal or other command shell window.

Change directory (cd) to one of the employee sample directories (for example, java/sample_ber/Employee).

Execute the ASN1C compiler by typing.

..\..\..\bin\asn1c employee.asn -java -ber -print -pkgpfx sample_ber

Change the CLASSPATH variable by typing on the command line:

SET CLASSPATH=c:\acv77x\java\asn1rt.jar;c:\acv77x\java;%CLASSPATH%

Run the Java compiler.

Since several Java files need to be compiled, type the following command on the command line:
javac *.java

It is now possible to run the generated java .class files.

This can be done by typing java writer (to write the encoded file) and java reader (to read the encoded file).

Note: A makefile and a build.bat file contain all of these commands. These files are included with the ASN1C compiler.