Log in

View Full Version : jars: creating and adding


byteit101
29-12-2010, 15:27
I am working on packaging up the ZomB Dashboard bindings for java, and I have two questions: How do you create a jar as a library? and How do you add it to a project so it can use the jar?
When I build a project, it produces a jar file in suit/project_1.0.0.jar. Is this a good jar file? When I drop it on a project, or add it in the ant classpath, it produces errors:init:
No to.jar.file specified.
Using "suite\RobotTemplate_1.0.0.jar"
Deleting directory C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\build
Deleting directory C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\suite
Deleting directory C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\j2meclass es
clean:
Created dir: C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\build
Compiling 1 source file to C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\build
C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\src\edu\w pi\first\wpilibj\templates\RobotTemplate.java:10: package org.thecatattack.System451.Communication.Dashboard does not exist
import org.thecatattack.System451.Communication.Dashboard .*;
C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\src\edu\w pi\first\wpilibj\templates\RobotTemplate.java:22: cannot find symbol
symbol : class ZomBDashboard
location: class edu.wpi.first.wpilibj.templates.RobotTemplate
ZomBDashboard zomB = ZomBDashboard.getInstance(ZomBModes.TCP, "10.4.51.5");
^
C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\src\edu\w pi\first\wpilibj\templates\RobotTemplate.java:22: cannot find symbol
symbol : variable ZomBModes
location: class edu.wpi.first.wpilibj.templates.RobotTemplate
ZomBDashboard zomB = ZomBDashboard.getInstance(ZomBModes.TCP, "10.4.51.5");
^
C:\Documents and Settings\***\My Documents\NetBeansProjects\RobotTemplate\src\edu\w pi\first\wpilibj\templates\RobotTemplate.java:22: cannot find symbol
symbol : variable ZomBDashboard
location: class edu.wpi.first.wpilibj.templates.RobotTemplate
ZomBDashboard zomB = ZomBDashboard.getInstance(ZomBModes.TCP, "10.4.51.5");
^
4 errors
C:\Documents and Settings\***\sunspotfrcsdk\ant\compile.xml:48: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 18 seconds)

Datalore
06-01-2011, 18:16
From command line,

ant jar-app to make the jar file

To add the proper syntax highlighting things, you have to add it to the netbeans classpath file, as you have done.

To deploy the library jar with the rest of the code, run
ant deploy -Dutility.jars=myLibrary.jar