Results 1 to 12 of 12
  1. #1
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Arrow Cannot find symbol error

    BoyerMooreServer.java
    import java.rmi.*;

    public class BoyerMooreServer {
    public static void main(String args[]) {
    try {
    BoyerMoore b= new BoyerMooreImpl("BoyerMooreServer");
    Naming.rebind("rmi://localhost:1099/BoyerMooreService", b);
    } catch (Exception e) {
    System.out.println("Trouble: " + e);
    }
    }
    }

    I already have BoyerMoore.java and BoyerMooreImpl.java...
    Its a client server program using RMI in java....
    I m getting error again and again at this line in the above program....Don't know y.....

    BoyerMoore b= new BoyerMooreImpl("BoyerMooreServer");

  2. #2
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default Re: Cannot find symbol error

    BoyerMooreImpl.java class as been extend the UnicastRemoteObject class or not & impliement the BoyerMoore.java class
    it helps you i think so.

    if problem is not solved then print the stracktrace of expection.

  3. #3
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Cannot find symbol error

    I have done that before but i m getting the error given below....

    I have also compiled all the files and all got compiled except BoyerMooreServer.java...

    $ javac BoyerMooreServer.java
    BoyerMooreServer.java:6: cannot find symbol
    symbol : constructor BoyerMooreImpl(java.lang.String)
    location: class BoyerMooreImpl
    BoyerMooreImpl b= new BoyerMooreImpl("BoyerMooreServer");
    ^
    1 error

    Error is at new operator...
    Last edited by abdulahadone; 03-22-2012 at 05:29 PM.

  4. #4
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Cannot find symbol error

    I have done that before but i m getting the error given below....

    I have also compiled all the files and all got compiled except BoyerMooreServer.java...

    $ javac BoyerMooreServer.java
    BoyerMooreServer.java:6: cannot find symbol
    symbol : constructor BoyerMooreImpl(java.lang.String)
    location: class BoyerMooreImpl
    BoyerMooreImpl b= new BoyerMooreImpl("BoyerMooreServer");
    ^
    1 error

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Cannot find symbol error

    Show us the constructor of the BoyerMooreImpl class that takes a String parameter ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Cannot find symbol error

    BoyerMooreImpl.java

    import java.io.*;
    import java.rmi.server.*;
    import java.rmi.*;

    public class BoyerMooreImpl extends UnicastRemoteObject
    implements BoyerMoore {
    private int R; // the radix
    private int[] right; // the bad-character skip array

    private char[] pattern; // store the pattern as a character array
    private String pat;
    // or as a string

    public BoyerMooreImpl()
    throws RemoteException {
    super();
    }
    // pattern provided as a string
    public int Bo(String pat) throws RemoteException {
    this.R = 256;
    this.pat = pat;

    // position of rightmost occurrence of c in the pattern
    right = new int[R];
    for (int c = 0; c < R; c++)
    right[c] = -1;
    for (int j = 0; j < pat.length(); j++)
    right[pat.charAt(j)] = j;
    return 0;
    }

    // pattern provided as a character array
    public void Bo(char[] pattern, int R) throws RemoteException{
    this.R = R;
    this.pattern = new char[pattern.length];
    for (int j = 0; j < pattern.length; j++)
    this.pattern[j] = pattern[j];

    // position of rightmost occurrence of c in the pattern
    right = new int[R];
    for (int c = 0; c < R; c++)
    right[c] = -1;
    for (int j = 0; j < pattern.length; j++)
    right[pattern[j]] = j;
    }

    // return offset of first match; N if no match
    public int search(String txt) throws RemoteException{
    int M = pat.length();
    int N = txt.length();
    int skip;
    for (int i = 0; i <= N - M; i += skip) {
    skip = 0;
    for (int j = M-1; j >= 0; j--) {
    if (pat.charAt(j) != txt.charAt(i+j)) {
    skip = Math.max(1, j - right[txt.charAt(i+j)]);
    break;
    }
    }
    if (skip == 0) return i; // found
    }
    return N; // not found
    }


    // return offset of first match; N if no match
    public int search(char[] text) throws RemoteException{
    int M = pattern.length;
    int N = text.length;
    int skip;
    for (int i = 0; i <= N - M; i += skip) {
    skip = 0;
    for (int j = M-1; j >= 0; j--) {
    if (pattern[j] != text[i+j]) {
    skip = Math.max(1, j - right[text[i+j]]);
    break;
    }
    }
    if (skip == 0)
    {
    System.out.println("Match found");
    return i;
    } // found
    }
    System.out.println("Match not found"); // not found
    return N;
    }

    // test client
    public static void main(String[] args) throws RemoteException {

    System.setSecurityManager(new RMISecurityManager());
    String pat = args[0];
    String txt = args[1];
    char[] pattern = pat.toCharArray();
    char[] text = txt.toCharArray();

    BoyerMooreImpl boyermoore1 = new BoyerMooreImpl();
    boyermoore1.Bo(pat);
    BoyerMooreImpl boyermoore2 = new BoyerMooreImpl();
    boyermoore2.Bo(pattern,256);
    int offset1 = boyermoore1.search(txt);
    int offset2 = boyermoore2.search(text);
    PrintStream StdOut = System.out;
    // print results
    StdOut.println("text: " + txt);

    StdOut.print("pattern: ");
    for (int i = 0; i < offset1; i++)
    StdOut.print(" ");
    StdOut.println(pat);
    StdOut.print("pattern: ");
    for (int i = 0; i < offset2; i++)
    StdOut.print(" ");
    StdOut.println(pat);
    }
    }

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Cannot find symbol error

    See? There is no constructor in that class that takes a single String as its parameter. Problem solved ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Cannot find symbol error

    So please tell me what shuld i do now...
    i don't know what to insert and where to insert in the program...plese reply..

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Cannot find symbol error

    Quote Originally Posted by abdulahadone View Post
    So please tell me what shuld i do now...
    i don't know what to insert and where to insert in the program...plese reply..
    It's your code so you should know what to do: either create a constructor that takes a single String parameter or don't call it with such parameter and use the existing no-args constructor.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Cannot find symbol error

    You've managed to write that much code and you don't know how to write a constructor that takes a String parameter?
    Crikey...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Cannot find symbol error

    Quote Originally Posted by Tolls View Post
    You've managed to write that much code and you don't know how to write a constructor that takes a String parameter?
    Crikey...
    There are more things in heaven and earth Tolls; the code could've come to the OP in mysterious ways ...

    kindest regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  12. #12
    abdulahadone is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Cannot find symbol error

    Thanks jos...
    Got it ...
    I have excuted and got the result...

Similar Threads

  1. Error: Cannot find symbol
    By surendra0607 in forum New To Java
    Replies: 3
    Last Post: 02-05-2012, 09:13 PM
  2. Error: Cannot Find Symbol
    By mawright in forum New To Java
    Replies: 4
    Last Post: 04-14-2011, 03:41 PM
  3. Cannot Find Symbol Error
    By javadummy1 in forum New To Java
    Replies: 6
    Last Post: 04-09-2011, 11:13 AM
  4. Replies: 9
    Last Post: 10-18-2008, 09:26 PM
  5. 'Cannot find symbol' error
    By minihazard10 in forum New To Java
    Replies: 6
    Last Post: 10-10-2008, 05:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •