Contents
Here are a few quick steps to get you started:
The samples/standards directory contains sample programs that demonstrate support for various industry standards using ASN.1.
asn1pjav your_source.asn
asn1pjav your_source.asn -ber -per -output project_name
asn1pjav your_source.asn -ber -xer -test
your_project.batIf you compiled with the -test option, then you can run the encoder/decoder tests with the Test class.
java your_project.Test
NOTE: Always run javadoc with the -public option. Only public methods and constructors in the generated Java code are available for your use.
asn1pjav your_source.asn
asn1pjav your_source.asn -ber -per -output project_name
asn1pjav your_source.asn -ber -xer -test
sh your_project.shIf you compiled with the -test option, you can run the encoder/decoder tests with the Test class.
java your_project.Test
NOTE: Always run javadoc with the -public option. Only public methods and constructors in the generated Java code are available for your use.
java <Class_Name>
java <Class_Name>
The OSS ASN.1 Tools for Java comes with numerous samples that illustrate how your application can use the classes generated by the OSS ASN.1/Java compiler.
Each sample program owns a subdirectory in the samples directory. Each subdirectory contains the gui subdirectory, which contains an ASN.1 Studio project for the sample. For example, the baseball sample is located in the samples\basic\baseball directory.
Each sample includes the following files and directory:
For details about ASN.1 Studio, see ASN.1 Studio Help.
Each of the samples can be run individually or you can run all the samples in one step. To run the samples one by one, follow the same procedure used to run the baseball sample: change to a sample directory and invoke the run.bat file, which will run the sample.
The run.bat file will create a compile.log file, which contains messages from the ASN.1/Java compiler. This file is useful if you have problems when running the sample. When you are finished running the sample, you can remove all the intermediate files and return the sample directory to its previous clean state by invoking run.bat with the clean parameter:
run clean
To run all the samples in one step, change to the samples directory and invoke the runall.bat batch file:
runall
The runall.bat file will execute all the run.bat files in the samples\basic and samples\advanced subdirectories, creating a run.log file in each subdirectory. Change to a sample directory and examine the run.log file to see the result of running the sample. The cleanup.bat file in the samples directory will invoke all the run.bat files with the clean parameter.
For more information, see the README.TXT file in the samples directory.
The OSS ASN.1 Tools for Java comes with numerous samples that illustrate how your application can use the classes generated by the OSS ASN.1/Java compiler.
Each sample program owns a subdirectory in the samples directory. Each subdirectory contains the gui subdirectory, which contains an ASN.1 Studio project for the sample. For example, the baseball sample is located in the samples/basic/baseball directory.
Each sample includes the following files and directory:
For details about ASN.1 Studio, see ASN.1 Studio Help.
Before running the samples, we recommend that you create your own copy of the samples directory. Each of the samples can be run individually or you can run all the samples in one step. To run the samples one by one, follow the same procedure used to run the baseball sample: change to a sample directory and invoke the run.sh shell script, which will run the sample. It's a good idea to capture the sample output in a file, so it can be examined later on.
sh run.sh | tee run.log
The run.sh script will create a compile.log file, which contains messages from the ASN.1/Java compiler. This file is useful if you have problems when running the sample. When you are finished running the sample, you can remove all the intermediate files and return the sample directory to its previous clean state by invoking run.sh with the cleanup parameter:
sh run.sh cleanup
To run all the samples in one step, change to the samples directory and invoke the runall.sh script:
sh runall.sh
The runall.sh script will execute all the run.sh scripts in the samples/basic and samples/advanced subdirectories, creating a run.log file in each subdirectory. Change to a sample directory and examine the run.log file to see the result of running the sample. The cleanup.sh script in the samples directory will invoke all the run.sh scripts with the cleanup parameter.
For more information, see the README.TXT file in the samples directory.
To check that your installation is complete, compile and run the baseball sample.
The samples for Windows 8 and later platforms are installed in the folders pointed to by the ALLUSERSPROFILE environment variable that, by default, is set to C:\ProgramData. Using this default setting, the samples are installed in the following folder:
C:\ProgramData\OSS Nokalva\asn1pjav\<platform name>\<version number>\samples
If you use the OSS command prompt window, you do not need to set the environment variables before running the samples. All environment variables are automatically set as needed in the OSS command prompt window. Otherwise, before running any samples, make sure you have set up the environment variables as required by the OSS ASN.1 Tools for Java installation.
To run the baseball sample:
C:\> cd \ProgramData\OSS Nokalva\asn1pjav\<platform name>\<version number>\samples\basic\baseball
C:\ProgramData\OSS Nokalva\asn1pjav\<platform name>\<version number>\samples\basic\baseball> run
If you experience problems when running the baseball sample:
To check that your installation is complete, compile and run the baseball sample.
Before running any samples, make sure you have set the environment variables as required by the OSS ASN.1 Tools for Java installation. You may also need to copy the samples directory into your home directory if you do not have write permission for the Tools installation directory. We recommend that you create a copy even if the Tools installation directory is writable by you. To create a copy, change to your home directory or other directory that is writable by you and issue the following command:
(cd $OSS_ASN1_JAVA; tar -cf - samples) | tar -xf -
Now you are ready to run your local copy of the samples. The samples directory below refers to either your local copy or the installation samples directory, if you chose not to create a local copy.
To run the baseball sample:
C:\> cd /samples/basic/baseball
sh run.sh | tee run.log
diff run.log sample.out
If you experience problems when running the baseball sample:
Running the baseball sample manually can help you solve setup problems. Also, it gives you an idea of how to compile and run your own application. In general, the following steps are required for any ASN.1 Tools for Java application:
The baseball sample compiles and runs Tbcas.java, the simple Java application program that uses the baseball.asn ASN.1 schema. To manually run the above steps for the baseball sample, do the following:
C:\> cd \ProgramData\OSS Nokalva\asn1pjav\<platform name>\<version number>\samples\basic\baseball
asn1pjav baseball.asn
set CLASSPATH=%OSS_ASN1_JAVA%\samples\basic\baseball;%CLASSPATH%
cd baseball baseball javac
cd .. javac Tbcas.java
java Tbcas
At this point, you will see trace information printed out by the OSS ASN.1/Java runtime.
Running the baseball sample manually can help you solve setup problems. Also, it gives you an idea of how to compile and run your own application. In general, the following steps are required for any ASN.1 Tools for Java application:
The baseball sample compiles and runs Tbcas.java, the simple Java application program that uses the baseball.asn ASN.1 schema. To manually run the above steps for the baseball sample, do the following:
cd samples/basic/baseball
asn1pjav baseball.asn
setenv CLASSPATH $PWD:$CLASSPATHfor csh, issue:
CLASSPATH=$PWD:$CLASSPATH;export CLASSPATH for sh or ksh.
cd baseball sh baseball.sh
cd ../ javac Tbcas.java
java Tbcas
At this point, you will see trace information printed out by the OSS ASN.1/Java runtime.
ASN.1 Studio simplifies compiling and running the baseball sample. Follow the steps below:
\ProgramData\OSS Nokalva\asn1pjav\<platform name>\<version number>\samples\basic\baseball\gui
java Tbcas
At this point, you will see trace information printed out by the OSS ASN.1/Java runtime.
ASN.1 Studio simplifies compiling and running the baseball sample. Follow the steps below:
<installation root>/asn1pjav/<platform name>/<version number>/samples/basic/baseball/gui
java Tbcas
At this point, you will see trace information printed out by the OSS ASN.1/Java runtime..
This documentation applies to the OSS® ASN.1 Tools for Java release 8.7 and later.
Copyright © 2024 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for Java is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for Java are available to you.