Jump to content
Changes to the Jaspersoft community edition download ×

DecimalFormat in scriptlet context


jmurray

Recommended Posts

I am trying to use java.text.DecimalFormat in a scriptlet so that the string representation of a number does not appear in scientific notation. Unfortunately the compiler always complains as shown in the code sample below:

 

 

Code:
import net.sf.jasperreports.engine.*;
import java.text.DecimalFormat;


[snip]


public String myNumberFormat(Double v1) throws JRScriptletException
{

/** make a string out of the Double that was passed in **/
java.text.DecimalFormat formatter = java.text.DecimalFormat("#0.#"«»);

String p = formatter.format(v1);


[snip]


C:ReportsDigiTollNETFLOWNF_PORT_TOTALS_SITE_SUBScriptlet.java:20:ÂcannotÂfindÂsymbol
 symbolÂÂ:ÂclassÂtext
 location:ÂpackageÂjava
 java.text.DecimalFormatÂformatterÂ=Âjava.text.DecimalFormat("#0.#"«»);
 ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ^Â

 

 

Removing the "java.text." class directive simply changes the error to "cannotÂfindÂsymbol DecimalFormat".

 

 

It's like the scriptlet engine doesn't follow or know about the iReport classpath. Putting rt.jar into the iReport lib directory along with all the other jrs didn't help either.

 

 

Any ideas?

 

 

 

.

Post edited by: jmurray, at: 2007/01/18 21:49

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...