Autoplot from source
From autoplot.org
Contents |
1 Building on command line using Ant
The svn for Autoplot is https://vxoware.svn.sourceforge.net/svnroot/vxoware/autoplot/trunk. Tagged versions are in https://vxoware.svn.sourceforge.net/svnroot/vxoware/autoplot/tags. Branch versions are in https://vxoware.svn.sourceforge.net/svnroot/vxoware/autoplot/branches.
svn co https://vxoware.svn.sourceforge.net/svnroot/vxoware/autoplot/trunk/ autoplot
Check out the sources with Netbeans or some other svn client into the directory "autoplot"
There are a number Netbeans projects that can be built with ant. They are:
- VirboAutoplot -- Autoplot gui and application model
- CDFDataSource -- support for CDF.
- CEFDataSource -- support for CEF.
- JythonDataSource -- dataset mashups using python code.
- WavDataSource -- the result of the wav tutorial
- DataSourcePack -- a number of data sources, including NetCDF, excel, and ascii tables.
- DataSource -- data source plugin interface and utilities
- QDataSet -- the data model
- APLibs -- an empty project with no sources, but all the libraries needed are in libs.
The "src" directory of each of these folders contains the java source code. Together these should show nicely what's going on under the hood.
Das2 is the library that provides interactive 2D graphics. It should be automatically checked out along with the Autoplot source.
To build using ant, change into the VirboAutoplot project, and run: "ant jar". The default target will compile all sub projects, and the resulting jar files will be in dist.
cd VirboAutoplot ant jar
To use the projects in Netbeans (6.1 or later), do the check out from within Netbeans and it should discover the projects after check out. Then build VirboAutoplot.
2 Building in Netbeans
A series of screenshots is found here
3 Building in Eclipse
These instructions are designed to explain how to set up an Autoplot project in Eclipse. Note that the Eclipse user interface varies from one version to another, but the steps are similar.
You will need Eclipse, of course, with a Subversion plugin such as Subclipse.
3.1 Installing Subclipse
To see if you have already have the Subclipse plugin installed, select the "About Eclipse" in the "Help" menu of Eclipse. Select "Plug-in Details" on the pop-up and look for something related to "SVN" or "Subversion". If you do not have the Subclipse plugin, that is easily rectified:
Select the "Software Updates" option in Eclipse's "Help" menu and add a new remote update site. The URL for the Subclipse update site is http://subclipse.tigris.org/update_1.4.x. Once you have added this update site, select the Subclipse components that you want to install. You won't need the optional parts.
3.2 Checking Out from SVN
When you see a pop-up about a security certificate, you must click Accept Permanently. If not, your build will fail when the das2 part of the repository is checked out.
Start by adding the "Subversion Repositories" view to Eclipse via the "Window/Show View/Other..." menu. In the "Subversion Repositories" view, add a new SVN repository (upper right icon). Enter the URL to the Autoplot repository: https://vxoware.svn.sourceforge.net/svnroot/vxoware.
Once you are connected to the repository, drill down to autoplot/trunk. Right click on trunk and select "Checkout...". Go with the defaults and you should end up with a Java project called "autoplot" in the "Package Explorer" view.
Note, for your "convenience," eclipse puts all the source code and jar files near the top of the project (note the "package" and "jar" icons). This may make it look like you have duplicate folders in your project. You can use eclipse's "Navigator" view to see the actual directory structure of the project.
3.3 Configuring the Project
Once you have checked out the Autoplot code from the Subversion repository, the project should appear in Eclipse's "Package Explorer." There will be a white-on-red "X" on the project name indicating that it is not happy. The problem is that we need to build some jar files to meet all the dependencies. Before building, you must:
- Set source level to 5.0 using File > Properties > Java Compiler > Compliance Level > 5.0
- Set JAVA_HOME
- Windows - In Windows File Broswer, find directory name of a jdk on your system, for example, C:\Program Files\Java\jdk1.5.0_09 and copy the name into the clipboard. Right click on My Computer > Properties > Advanced > Environment Variables > New > Enter JAVA_HOME and C:\Program Files\Java\jdk1.5.0_09.
- Linux and OS X - Set variables on command line http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html (Should be able to do this on Windows by modifying the eclipse shortcut to include the -vm option)
- Linux 64-bit Ubuntu - there are many problems with Eclipse crashing that is no fault of Autoplot. Do a web search and try many things. I don't know how I got it to work, but I did. Here is the output of ps
/usr/lib/eclipse/eclipse -vm /usr/lib/jvm/java-6-sun/bin/java -install /usr/lib/eclipse -startup /usr/lib/eclipse/startup.jar -vmargs -Djava.library.path=/usr/lib/jni -Dgnu.gcj.precompiled.db.path=/var/lib/gcj-4.2/classmap.db -Dgnu.gcj.runtime.VMClassLoader.library_control=never -Dosgi.locking=none
3.4 Compiling Autoplot
Click the arrow next to the big green start button on the main eclipse menu bar and you should see "eclipse_build_jars" in the drop down list.
If this does not work, look for the file named "eclipse_build_jars.launch" near the bottom of the autoplot project file and folder list. Right-click and select "Debug As > Debug".
or
Right-click and select "Run As > eclipse_build_jars" and eclipse will run the ant build to generate the jar files for each autoplot component.
If you get an AudioSystemDataSource error, select Projects > Properties > Java Build Path > Libraries and deselect AutoSystemDataSource.jar.
I had many problems on Ubuntu 8.04 64-bit, both with Eclipse always crashing (uncheckProject > Build Automatically because sometimes the build induces a crash) Eventually clicking the smaller green button and selecting eclipse_build_jars indicated by a ant icon would result in a build without complaints about BinaryDataSource being missing. Try various things like clicking the small and large green buttons and trying to run as an application or to run in debug mode.
3.5 Running the Autoplot UI
Look for the file named "eclipse_run_autoplot.launch" in the "ProjectExplorer" under "autoplot." Right-click on the file and select Run As>Run>Java Application>eclipse_run_autoplot
or
Right-click on eclips_run_autoplot.launch > Debug As > Debug.
or
Look for the file named "eclipse_run_autoplot.launch" in the "ProjectExplorer" under "autoplot." Right-click on the file and select "Run As (or Debug As) > eclipse_run_autoplot and let the fun begin. You should also be able to do likewise via the run and debug icons near the top of the eclipse window, though you may need to run it once as described above. You can also get there from the "Run" menu.
4 Building Servlet
A simple servlet is found in the repository at https://vxoware.svn.sourceforge.net/svnroot/vxoware/autoplot/trunk/AutoplotServlet. This shows how Autoplot can be used to create graphics on the server-side, when used with a J2EE container like Apache Tomcat.
- Check out and build Autoplot sources as described above.
- The location of a server's classpath must be specified. Locate a J2EE instance, such as Tomcat.
- change directory to the location of the ant build script, build.xml.
- Use ant to compile the servlet, using (where the classpath is set to your server location):
ant -Dj2ee.platform.classpath=/usr/local/tomcat-6/lib/servlet-api.jar dist
or for Tomcat 5.5.20:
ant -Dj2ee.platform.classpath=/usr/local/tomcat-5.5.20/common/lib/servlet-api.jar dist
- The war file will be found in the "dist" folder.
5 Building Applet
An applet that uses Autoplot to provide lightweight client-side browsing from applet-compatible data sources is provided in AutoplotApplet.
- Check out and build Autoplot sources as described above.
- change directory to AutoplotApplet
- ant jar
- This will compile AutoplotApplet.jar in dist, and should copy the compatible data source jars over to dist/lib.
- AutoplotApplet.jar contains references to the other jars in its manifest and dist can be copied to a webserver for testing.
- Remember with unsigned applets:
- data must come from the same server as the applet.
- data cannot be stored on the client side. Currently most data sources copy to the client's cache and work from there. Some, like the BinaryDataSource, have been modified to support use in applets.
- An example html file is copied over to dist as well.
- Use appletviewer to test your applet, then if it works there, copy it to the server and hope for the best.
AutoplotApplet/jar-applet.sh is a script that builds dist/AutoplotAppletAll.jar. This script contains a reference to /usr/local/jdk1.5.0_17/bin/jar. Change this to the name of a Sun-supplied java, NOT the jar (fastjar) supplied with some linux distros.
6 Building "jumbojar" (All Classes)
VirboAutoplot/jar-all.sh is a script that builds dist/AutoplotAll.jar.
