File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Prime numbers - code problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Prime numbers - code problem" Watch "Prime numbers - code problem" New topic
Author

Prime numbers - code problem

Clive van Hilten
Greenhorn

Joined: Jul 26, 2001
Posts: 5
Hi there - can anyone tell me why this will not compile?
======================================================
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
import java.math.*;

//generates a prime of approx. 50 digits
public class SimplePrimeTag extends TagSupport
{
protected int len = 50;
public int doStartTag()
{
try
{
JspWriter out = pageContext.getOut();
BigInteger prime = Primes.nextPrime(Primes.random(len));
out.print(prime);
}
catch (IOException ioe)
{
System.out.println("Error generating prime: " + ioe);
}
return (SKIP_BODY);
}
}
============================================================
Error message reads:
E:\Program Files\Apache Group\Tomcat2\webapps\examples\WEB-INF\classes\coreservlets\tags\SimplePrimeTag.java:20: cannot resolve symbol
symbol : variable Primes
location: class SimplePrimeTag
BigInteger prime = Primes.nextPrime(Primes.random(len));
^
E:\Program Files\Apache Group\Tomcat2\webapps\examples\WEB-INF\classes\coreservlets\tags\SimplePrimeTag.java:20: cannot resolve symbol
symbol : variable Primes
location: class SimplePrimeTag
BigInteger prime = Primes.nextPrime(Primes.random(len));
^
2 errors
==============================================================
I copied this straight from a Sun custom jsp tags tutorial.
Thank you.
Clive
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
It looks like it can't find the class Primes, so it thinks that it is a variable that you forgot to declare and instantiate.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Clive van Hilten
Greenhorn

Joined: Jul 26, 2001
Posts: 5
Thanks Cindy. Where is the class Primes to be found? I would have thought it was covered by 'import java.math.*'?
Roy Tock
Ranch Hand

Joined: Jul 16, 2001
Posts: 83
Being a mathematician, I'm VERY interested to see this Primes class. I'd even be more interested in seeing the source.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Prime numbers - code problem
 
Similar Threads
Package not found error in JSP
image database compilation problem
classpath setting rightly. But strange problem
compile error in coreservlet book code
unnable to create object of a class..