ERRORsymbol:class UserTransaction(cannot find symbol)/package javax.mail.in

Hi people, I am trying to compile a web proyect in MyEclipse with Ant 1.6.2, but now it appears an error that says :
[javac] F:\...\Doc1.java:13: cannot find symbol
[javac] symbol : class UserTransaction
[javac] location: package javax.transaction
[javac] import javax.transaction.UserTransaction;
[javac] ^
and another one:
[javac] F:\...\Doc2.java:19: package javax.mail.internet does not exist
[javac] import javax.mail.i nternet.MimeMultipart;
[javac] ^
I'm using tomcat 5.5.23
Could anyone say to me why could this happen???I think that I am using all the libraries I need and so on..
Thank you very much!!

You're not using all the libraries you need. :-)
UserTransaction is part of Java EE. You'll need Java EE support in your compilation
environment, and your program won't run on Tomcat. (Java EE support will also
include JavaMail, which you can use separately with Tomcat as well.)

Similar Messages

  • Cannot find symbol symbol : class Item location: package platypos.services.

    Well, I am having a few problems getting this java file to compile.
    /home/brandon/Desktop/platypos/services/order/Seat.java
    package platypos.services.order;
    import platypos.services.order.Item;
    import java.util.Vector;
    public class Seat
        private int             _number;
        private Vector<Item>    _items  = new Vector<Item>();
        public static void main(String args[])
            System.out.println("Hello");
    }here is my terminal session:
    brandon@Aspire5100:~$ javac /home/brandon/Desktop/platypos/services/order/Seat.java
    /home/brandon/Desktop/platypos/services/order/Seat.java:17: cannot find symbol
    symbol  : class Item
    location: package platypos.services.order
    import platypos.services.order.Item;
                                  ^
    /home/brandon/Desktop/platypos/services/order/Seat.java:23: cannot find symbol
    symbol  : class Item
    location: class platypos.services.order.Seat
        private Vector<Item>    _items  = new Vector<Item>();
                       ^
    /home/brandon/Desktop/platypos/services/order/Seat.java:23: cannot find symbol
    symbol  : class Item
    location: class platypos.services.order.Seat
        private Vector<Item>    _items  = new Vector<Item>();
                                                     ^
    3 errors/home/brandon/Desktop/platypos/services/order/Item.java is packaged as follows
    package platypos.services.order;and has been successfully compiled to Item.class in the same directory.
    I am using the latest JDK on Ubuntu 8.04
    I am a bit more skilled in C++ and am trying to learn java, anyone got any clues as to what I am doing wrong?
    Thank you

    yep, here is an abridged version of the Item.java file. and it has been successfully compiled to Item.class
    package platypos.services.order;
    import java.util.Vector;
    class Item
         // Constructor     
         public Item(String name)
              SetName(name);     
        // Main Function
        public static void main(String args[])
    }Edited by: javaperson on Apr 30, 2008 11:01 PM

  • Cannot find symbol     class Usernamebean

    hi i am new in j2ee
    can some body help to give the solution.
    i am always thankfull to everybody
    i have a servlet where i am calling a bean of same package but servlet not compile giving that error
    cannot find symbol class Usernamebean
    servlet code
    package ecomm; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import bengalcom.*; public class Loginservelet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { try {         String accnum=req.getParameter("username");   String pinnum=req.getParameter("password"); try { Class.forName("com.mysql.jdbc.Driver"); Connection dbcon=DriverManager.getConnection("jdbc:mysql://localhost/ecomm","root",""); PreparedStatement s = dbcon.prepareStatement("select * from vendordetails where email = ? and password = ? and blocking='No' "); s.setString(1,accnum); s.setString(2,pinnum); ResultSet result=s.executeQuery(); boolean rowfound=false; rowfound=result.next();   if(rowfound==true) { String vname=result.getString("fname"); String  vid=result.getString("vid"); String email=result.getString("email");   UsernameBean nameBean =new UsernameBean();   nameBean.setFirstName(accnum); HttpSession session = req.getSession(true); session.setAttribute("vname",vname); session.setAttribute("vid",vid); session.setAttribute("email",email);   RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/earea.jsp?vname=vname&vid=vid&email=email"); dispatcher.forward(req,res); dbcon.close(); } else{ RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/eblock.jsp"); dispatcher.forward(req,res); }   } catch(ClassNotFoundException e) { } } catch(SQLException e) { System.out.println(e.toString()); } } public void doPost(HttpServletRequest req, HttpServletResponse res)         throws ServletException, IOException     {         doGet(req, res);     } }

    Hi,
    java is case sensitive, Check the case in class name.
    Regards,
    Ram

  • Newbie question: cannot find symbol symbol: class STRING

    I've just decided to teach myself some java, and on my first try something's going wrong and I don't know what it is.
    I'm currently doing this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html
    and everything is good until I try to compile it and I get this error in the cmd
    HelloWorldSwing.java:30: cannot find symbol
    cannot find symbol
    symbol: class STRING
    everything has been written verbatim from the tutorial, including "import javax.swing.*;"
    What's wrong with it and how do I fix it?

    Hi,
    I saw the coding that You had given a link in your post. Change the following
        public static void main(String[] args) {bye for now
    sat

  • Cannot find symbol class

    I am having a "Cannot find symbol" problem. My Java is a bit rusty so I'm not exactly sure what it could be. I have two classes, City and SisterCities. The SisterCities references the City class. The City class compiles fine. Both classes are part of the same package. However, when I compile SisterCities, I get the error. Could you please tell me how to get the second class to recognize the first (import, extends, not really sure. I've tried alot) Here are those two classes so far...
    ****** City ********
    package hw01;
    public class City
         public final String name;
         public final String country;
         public final City [] sisters;
    public City (String name, String country)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [0];
    public City (String name, String country, City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [sisters.length];
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters;
    public void setSisters (City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters[i];
    public String getName ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.name;
    public String getCountry ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.country;
    public City [] getSisters ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.sisters;
    ******** SisterCities *********
    package hw01;
    import java.util.LinkedList;
    public class SisterCities
         public final LinkedList cityList;
    public SisterCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public void addCity (City city)
              // throw new RuntimeException ("Not implemented yet.");
              this.cityList.add(city);
    public int getNumCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public City getCity (int i)
              // throw new RuntimeException ("Not implemented yet.");

    final attribute members like "cityList" must be initialised when they're declared or inside the constructors
    if you want to compile, you'll also have to uncomment the "throws" in your methods (or return a value)
    (pay attention to the error messages the compiler gives you and paste them all when posting questions)

  • Cannot find symbol class entry

    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class Map
    for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
    ^
    1 error
    this is what i get when i try to compile this code, its the lowest part thats getting errors:
    import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
         private HashMap<Stad,List<ListEdge>> nodes =
              new HashMap<Stad,List<ListEdge>>();
         public void addNode(Stad ny){
              nodes.put(ny, new ArrayList<ListEdge>());
         public void connect(Stad from, Stad to, String n, int v){
              List<ListEdge> fromList = nodes.get(from);
              List<ListEdge> toList = nodes.get(to);
              ListEdge e1 = new ListEdge(to, n, v);
              fromList.add(e1);
              ListEdge e2 = new ListEdge(from, n, v);
              toList.add(e2);
         public String toString(){
              String ret = "";
              for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                   ret += me.getKey()+": "+me.getValue()+"\n";
              return ret;
    }

    Bananen123 wrote:
    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class MapI don't get the same error, so I'm not sure what code you are actually trying to compile. Do you happen to have defined another class named Map in the default package?
    Also, please use code tags when posting code. Example: import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
        private HashMap<Stad,List<ListEdge>> nodes =
            new HashMap<Stad,List<ListEdge>>();
        public void addNode(Stad ny){
            nodes.put(ny, new ArrayList<ListEdge>());
        public void connect(Stad from, Stad to, String n, int v){
            List<ListEdge> fromList = nodes.get(from);
            List<ListEdge> toList = nodes.get(to);
            ListEdge e1 = new ListEdge(to, n, v);
            fromList.add(e1);
            ListEdge e2 = new ListEdge(from, n, v);
            toList.add(e2);
        public String toString(){
            String ret = "";
            for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                ret += me.getKey()+": "+me.getValue()+"\n";
            return ret;
    class Stad {}
    class ListEdge{ ListEdge(Stad s, String str, int i) {} }~

  • Cannot find symbol : class ! problem

    Hello,
    I have 2 java files (CD.java & CDCatalog.java) in a package called "testPackage". I can compile CD.java, but CDCatalog.java (that creates CD instances) gives following error - cannot find symbol symbol : class CD
    Below are the 2 files, please tell me why I get this errors , thanks!
    1) CDCatalog.java
    package testPackages;
    import java.util.Hashtable;
    //import testPackages.CD;
    public class CDCatalog {
    /** The CDs, by title */
    private Hashtable catalog;
    public CDCatalog( ) {
    catalog = new Hashtable( );
    // Seed the catalog
    addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
    addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
    addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
    addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
    public void addCD(CD cd) {
    if (cd == null) {
    throw new IllegalArgumentException("The CD object cannot be null.");
    catalog.put(cd.getTitle( ), cd);
    2) CD.java
    package testPackages;
    public class CD {
    private String title;
    private String artist;
    private String label;
    public CD( ) {
    // Default constructor
    public CD(String title, String artist, String label) {
    this.title = title;
    this.artist = artist;
    this.label = label;
    public String getTitle( ) {
    return title;
    public void setTitle(String title) {
    this.title = title;
    public String getArtist( ) {
    return artist;
    public void setArtist(String artist) {
    this.artist = artist;
    public String getLabel( ) {
    return label;
    public void setLabel(String label) {
    this.label = label;
    public String toString( ) {
    return "'" + title + "' by " + artist + ", on " +
    label;
    }

    just tried it as well, no problems, provided you
    compile CD.java firstI just tried from the shell ans look at this...
    E:\testPackages>dir
    Volume in drive E is MYFLASHDISK
    Volume Serial Number is 483B-B160
    Directory of E:\testPackages
    05/24/2006  07:48 PM    <DIR>          .
    05/24/2006  07:48 PM    <DIR>          ..
    05/24/2006  07:20 PM             1,143 CD.java
    05/24/2006  07:50 PM             1,053 CD.class
    05/24/2006  07:56 PM               972 CDCatalog.java
                   3 File(s)          3,168 bytes
                   2 Dir(s)   1,024,503,808 bytes free
    E:\testPackages>javac -cp e:\testPackages CDCatalog.java
    CDCatalog.java:30: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
        public void addCD(CD cd) {
                          ^
    CDCatalog.java:24: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
                      ^
    CDCatalog.java:25: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
                      ^
    CDCatalog.java:26: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
                      ^
    CDCatalog.java:27: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
                      ^
    5 errors
    E:\testPackages>I am now officially confused. I even specified the exact path to the CD.class file and javac still didnt like it.
    I'll dig some more. It has to be related to the classpath some how..
    JJ
    Still Stumped.. I'll sleep on it..
    Message was edited by:
    Java_Jay

  • Cannot find symbol class error

    hi there ,
    i am creating a min class that links several classes and i am doing the following
    public class Main{
         public static void main(String[] args){
         classOne a = new classOne();
    classTwo b = new classTwo();
    classThree c = new classThree();
    // more classes with the same as above
    i am saving all the classes in the same folder , and i am having this error twice with each line that i creat an instance for a class
    cannot find symbol
    symbol : class classOne

    are your classes all in the same package? do you in fact use packages?
    Your best bet to get help here is by creating a Short, Self Contained, Correct (Compilable), Example or SSCCE. This is a small application that you create that is compilable and runnable, and demonstrates your error, but contains no extraneous, unnecessary code that is not associated with your problem. To see more about this and how to create this, please look at this link:
    http://homepage1.nifty.com/algafield/sscce.html
    Remember, this code must be compilable and runnable.
    Also, if you do post your code, please use code tags so that your code will be well-formatted and readable. To do this, either highlight your code block and press the "code" button at the top above the message block or place the tag &#91;code&#93; at the top of your block of code and the tag &#91;/code&#93; at the bottom, like so:
    &#91;code&#93;
       // your code block goes here
    &#91;/code&#93;

  • Cannot find symbol error when compiling in different packages

    Hey all,
    I'm trying to divide my project into a sensible hierarchy. This is what I want:
    MyProject
    MyProject/src ................................. where all the source files are (no further directories)
    MyProject/classes
    MyProject/classes/Main.class
    MyProject/classes/classes2 ................ sorry for not being creative XD
    MyProject/classes/classes2/Age.classNow, Age uses Main, and this is where the trouble is. I'm using javac directly to compile Age, and this is how I'm doing it:
    //from MyProject
    javac -cp classes src/Age.javaAnd I get this error:
    bla bla bla...cannot find symbol
    symbol  : variable Main
    location: class classes2.Age
              years = (byte)(Main.year - m.getYear());
                             ^Main is already compiled and in place.
    Also, this is how Age.java starts:
    package classes2;
    public class Age
    {...etcI'm using JCreator as an IDE (and using it's own build function, the same error occurs, which is why I tried directly compiling the file).
    Why can't javac find Main.class? I tried searching Google, but my particular problem didn't seem to crop up.
    Hope I provided enough information, and ask if more is needed.
    Many thanks :)

    If Main is not in a package (which it appears not to be), then it cannot be referenced by any class that is in a package. If Main is in a package, then you'll need to refer to it by it's fully-qualified name (or import it as such) if it's not in the same package as the class that's referring to it, and Main.class will have to be in a directory that corresponds to its package.
    Also, though the compiler may not require it, your source code directory structure should match your package hierarchy.

  • Javac = "cannot find symbol" when compiling class referencing other classes

    I have several Java files in a directory which is declared as a package at the start of the files
    package filemanager;
    This program works perfectly in an IDE, however I'm having problems with compiling in command line.
    I have set the classpath as I understand to be right for my computer to:
    C:\Program Files\Java\jdk1.6.0_02\bin
    I can compile a class that references no other classes in this package/directory.
    However files which reference other classes bring up such errors:
    javac AllFiles.javaAllFiles.java:174: cannot find symbol
    symbol : variable Bob
    location : class filesmanager.AllFiles
    Bob.getItem(itemRef);
    Where Bob is an example of another class. Even though I can say, compile Bob on it's own as it doesnt have any such reference.
    I've tried:
    javac -cp "C:\Program Files\Java\jdk1.6.0_02\bin" AllFiles.javaThis also failed.
    Any ideas?
    Edited by: ajr87 on Feb 8, 2008 10:26 AM

    I've tried spoon_'s suggestion, but I'm still getting the error ("cannot find symbol"). Here is my code:
    File Hello/Fred.java:
    package Hello;
    public class Fred
        public int age;
        public Fred()
            this.age = 1;
    } // public class FredFile Hello/Hello.java:
    package Hello;
    public class Hello
        public static void main(String args[])
            Fred fred = new Fred();
            System.out.println("Fred is " + fred.age);
    } // public class HelloAnd here is my attempt to compile Fred.java and Hello.java:
    C:/Users/levner/programs[219]javac -cp c:\users\levner\programs\hello Hello\Fred.java
    C:/Users/levner/programs[220]javac -cp c:\users\levner\programs\hello Hello\Hello.java
    Hello\Hello.java:14: cannot find symbol
    symbol  : class Fred
    location: class Hello.Hello
            Fred fred = new Fred();
            ^
    Hello\Hello.java:14: cannot find symbol
    symbol  : class Fred
    location: class Hello.Hello
            Fred fred = new Fred();
                            ^
    2 errorsI am doing this work on a PC running Vista using javac 1.6.0_10. I've tried various combinations of upper and lower case names for the package and file names, and I always get the same errors.
    Thanks in advance for your help. David

  • Cannot find symbol class ParseException

    I have this in my code how ever
    DateFormat formatter = new SimpleDateFormat("ddMMyyyy");
    dDateStamp = (Date)formatter.parse(dateStamp);
    When I pass in say
    dateStamp=safsadssad sa;
    I get an error which is fine.
    I can not seem to catch this error with try catch
    When I use the one below it says it cannot find the symbol
    When i use the Exception it still throws and error to jsp page
    cannot find symbol
    symbol : class ParseException
    }catch(ParseException e){   
    symbol : class ParseException
    }catch(ParseException e){   
    Any One know I csn trap this?
    Thanks in advance

    Well, it's in the j2se API. Not sure what to tell you...

  • Cannot find symbol class Scanner

    hi all
    i'm defining a class within a project so i can use the class inside my program, but the line:
    Scanner keyboard = new Scanner(System.in);generates an error with my compiler:
    cannot find symbol class Scanner
    please help

    you aren't using jdk 5 or higher then. that's when scanner was added to the jdk.
    download a modern jdk and you'll be fine.
    %

  • Cannot find Symbol :class CLOB

    Hi,
    I am using JDK1.5.0_06 and Oracle8.1.7.
    When i compile java program I am getting the following error
    cannot find symbol
    symbol : class CLOB
    I have added classes12.zip into classpath.
    Can anybody tell me why this errpr comes? Is there any other files instead of classes12.zip to be added (since its JDK1.5 version? )
    Thanks in advance
    neema

    you have mentioned about the class "studentList" but that class is not to be found in the code you have pasted. its instead "ListTest". And the "menu" function seems to b a part of "ListTest" class. Can you provide the structure of the classes "studentList" and "Student" so that the problem can be more clearly understood?
    also you are using the variable "Stdin" in the line int choice = Stdin.readInteger(); where as you have not declared this variable.
    in the "switch" statement you are calling two different functions for the same case "3" where as it should be "case 3" and "case 4" respectively.
    in the "main" you are calling the "menu" function without any parameter while you actually want to pass argument of type "studentList".

  • Java Error : cannot find symbol , symbol : class (jdk 1.6.0)

    Dear All,
    Please help me.
    I am running javac from a .bat file and i set the classpath in the bat file as follows.
    echo on
    :start
    set classpath = "C:\Program Files\Java\jdk1.6.0\bin;"
    set classpath = "C:\Program Files\Java\jdk1.6.0\jre\..\lib\tools.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\ldapsec.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\mysql-connector-java-5.0.0-beta-bin.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\sunjce_provider.jar; C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\studio\system;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\j2ee-1.3.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jaas-1.0.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\activation.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jms-1.0.2b.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jta-spec1_0_1.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\mail.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\AbsoluteLayout.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\sql.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\rowset.jar;C:\Program Files\Java\jdk1.6.0\studio\lib\ext\jdbc20x.zip;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\servlet-2.3.jar;C:\Program Files\Java\jdk1.6.0\studio\beans\TimerBean.jar;c:\Program Files\Java\jdk1.6.0\ideset\tomcat401_base;C:\sms\com\;"
    cd C:\sms
    javac mainP.java
    pause
    i have few class files which are inherited to the main program using ' import com.Connection; '
    i am getting errors like
    mainP.java:482: cannot find symbol
    symbol : class Connection
    location: class mainP
    Connection connection = new Connection(ipAddress, port);
    I think it is because of some classpath error.
    please advice me.......
    Viju

    Actually, you have NO CLUE what he's trying to doActually he said what he is trying to do in his posting. It's no mystery. But that's all the information that's available. If you know something that isn't posted here why not say so?
    Your reply was a snide, rude, "You're stupid for doing it that way" answerMy reply was neither snide nor rude and implied none of what you impute to it. It was a proper and constructive suggestion. You are entitled to disagree with it, but that doesn't justify this immoderate outburst.
    Bottom line is, you chose to be nastyBottom line is you're just making this up. You are imputing motives to me without evidence. Don't do that.
    You are the type of person that makes searching forums and posting questions for assistance a near waste of time.I doubt that you'll find many regulars here that would agree with that assertion. When you have made over 16,000 posts here over ten years as I have, come back and we'll discuss it some more.
    Go back to grade school and ...I suggest you try it yourself. You're not adding anything except noise to the discussion. Try curbing your temper, and while you're at it have a good look at the Code of Conduct for these forums. You're verging on personal abuse here.
    And, additionally, I've used ANT in the past. Batch files are FAR AND AWAY easier to set up.In your opinion. I disagree entirely, and I have eleven years' experience with Java to back it up.
    As for CLASSPATH, I haven't done anything about setting it beyond installing the JDK since about 1999, and it has a dot in it as we speak.

  • "cannot find symbol" error - password checker class

    I had to make a program to check a password to make sure it had two letters, at least eight characters, and only numbers and letters. I'm pretty sure I have all of the checking correct but I can't make use of the method I made to do it. here is my code:
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
                   //constructor
         public LegitPassword(String userPassword)
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
              }oh, and the exact error is:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())     
                         ^

    Here is the full code so that you can see how I declared password...
         public class PasswordChecker
              static Scanner console = new Scanner(System.in);
              public static void main(String[] args)
              String password;
              System.out.println("Please enter a new password.");
              System.out.println("Remember: Passwords must be at least eight characters"
                   + " consisting of only numbers and letters with at minimal two numbers.");
              System.out.print("Password: ");
                   password = console.nextLine();
              //LegitPassword thePassword = new LegitPassword(password);
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
    }The error:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())Are you suggesting I change the method, LegalPassword, to accept no parameters?

Maybe you are looking for