< Back To ASN1C Support

ASN1C Java Tutorial

Getting Started with the ASN1C Java command Line

This tutorial will help you use ASN1C Java using the MS-DOS command line. All steps before and including compiling using the ASN1C compiler can also be accomplished using the Graphical User Interface Wizard.

Open an MS-DOS or other command shell window.

It is necessary to set the PATH variable to point to the directory where asn1c.exe is located.

If the default path was selected on install, this would be the c:\acv65x\bin directory (note that the 'x' in acv65x would be replaced with a minor version number). The command in DOS would be:

SET PATH=%PATH%;c:\acv65x\bin

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

Execute the ASN1C compiler by typing.

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

Change the CLASSPATH variable by typing on the MS-DOS command line:

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

Run the Java compiler.

Since several Java files need to be compiled, type the following command on the MS-DOS 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 come with the ASN1C compiler.
Note: * Java and all Java-related products are registered Trademarks of Oracle Corporation