|
NetBeans
jSNARK has been developed using NetBeans and the
NetBeans project files are present in the SVN
repository.
Adding a new plug-in to jSNARK
It is not necessary to download the jSNARK source
files in order to add a new plug-in to the system.
Using NetBeans, the process is as follows:
- Create a new NetBeans project of the type
"Java Class Library".
Click "File"=>"New Project..." or the "New
Project" icon. Choose "Java", then "Java Class
Library". Click "Next". Enter the name of the
new project. By default, the new project will be
created in the "Project Location" folder with
your project name. Click the "Browse" button if
you want the project located somewhere else.
Click "Finish" to complete creating the project.
- Add jSNARK.
Right click on the project and select Properties
at the bottom of the pop-up menu. In the
Properties window, click Libraries, then "Add
Jar/Folder". Navigate to where you unpacked the
jSNARK zip file and then to the lib directory.
Select the jSNARK.jar.
- Create the new plug-in.
In the project, right click on the "Source
Packages" folder and select New => Java
Package. Give the package a name. Right click on
the package and select New=>Java Class. Add
the extends and implements jSNARK classes that
are appropriate for the plug-in. NetBeans will
offer to generate the necessary import
statements and stub methods. Complete the
implementation of those methods.
- Create a jar file containing the new plug-in.
Click the "Clean and Build" icon or right click
the project and then click "Clean and Build." If
errors were reported, fix them and repeat this
step.
- Create a jSNARK input file that uses the new
plug-in.
When the new plug-in compiles successfully,
start the jSNARK_GUI. Click "Load Plug-in" and
navigate to the "dist" directory of the NetBeans
project and click the jar file contained in that
directory. Either open an existing snark script
or start a new one. If everything is correct,
your new plug-in will appear in the appropriate
drop-down list in the GUI. Modify the script to
create a jSNARK experiment and run it.
Now you have all the pieces, but unless you were
extremely lucky, your plug-in does not work. So, how
do you debug it?
If you are comfortable using JUNIT, test your
plug-in independently of the jSNARK program. This is
the preferred testing method. NetBeans has tools to
create a skeleton test file and allows the test file
to be run in the debugger. Use the
Properties->Run window to set the working
directory.
-OR-
NetBeans does not allow you to run the jSNARK jar
file from within your project. Instead, you will
have to download the jSNARK sources following the
instructions below. NetBeans should have found and
opened the jSNARK project. Fix the references to the
jdom, xercesImpl, and jsnark_plugins jar files.
These are all located in the lib directory where you
unzipped the jSNARK distribution. Also, add a
reference to your jar file. Now select "Run". Change
the "Working Directory" to where you created the
jSNARK test script and put the name of the script in
the "Arguments" field. Running jSNARK in debug mode
from NetBeans will allow you to insert breakpoints
in your code, examine variables, and perform other
debugging operations.
SVN organization
jSNARK consists of a number of components. They are:
- jSNARK_GUI
- A graphical interface to create and edit
jSNARK XML input files.
- jSNARK
- The jSNARK program.
- lib
- The external libraries used by jSNARK.
- runJSNARK
- A helper program used by the jSNARK.sh and
runall.sh scripts.
- jSNARK_plugins
- Stubs for plug-ins that have not been written
yet.
- jSNARK_tools
- A catchall for useful utilities. Currently
this only contains the skeleton program to
convert a user's real projection data file into
the format needed by jSNARK.
- netbeans
- Instructions and files needed to set up jSNARK
with the NetBeans IDE.
- examples
- The set of example files in the distribution.
- manual
- The LyX sources for the manual.
- regression
- Tools to preform regression testing of a new
version against an old version.
- compareCSVfiles
- A tool used by regression testing.
- ant
- Ant scripts to create the distribution
package.
Under each of these top level SVN directories are
the usual "trunk", "branches", and "tags"
directories.
SVN checkout
To checkout jSNARK using NetBeans, go to
Team->SVN->checkout. Enter:
svn://svn.code.sf.net/p/jsnark/code/
in the Repository URL field. Leave the User name and
password fields blank for anonymous access. Click
"Next". Click browse in the next window. for each of
the jSNARK components navigate to the trunk entry.
Click the checkbox to skip "trunk" and checkout only
its content. Set the directory where the checkout
should occur. Click the checkbox for scan the
directory for NetBeans Projects after Checkout. All
the JAVA directories are NetBeans projects. The
others are not. Click "Finish" to checkout the
files.
Building and running jSNARK
The NetBeans project files reference libraries using
paths on my system. This will result in reference
problems on your system. Fix the reference problems
for the jSNARK component. It references libraries
from the lib component. Build jSNARK. Now one by one
fix the reference problems with the rest of the
components and build them. Some of these reference
the jSNARK.jar file created by the first build.
To run jSNARK from within NetBeans, it is necessary
to pass the full path name to the *.snark file you
wish to execute on the arguments line. Set the
working directory to where you want the outputs to
be written.
To execute jSNARK_GUI from within NetBeans, it must
be compiled with the "Compile on Save" option turned
off.
Joining jSNARK
Join
jSNARK if you wish to contribute to its
development. |