Results 1 to 12 of 12
Thread: Cannot find symbol error
- 03-22-2012, 08:14 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
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");
- 03-22-2012, 08:39 AM #2
Member
- Join Date
- May 2011
- Posts
- 27
- Rep Power
- 0
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.
- 03-22-2012, 04:26 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
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 04:29 PM.
- 03-22-2012, 04:28 PM #4
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
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
- 03-22-2012, 04:31 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
Re: Cannot find symbol error
Show us the constructor of the BoyerMooreImpl class that takes a String parameter ...
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-22-2012, 04:41 PM #6
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
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);
}
}
- 03-22-2012, 04:45 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-22-2012, 04:50 PM #8
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
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..
- 03-22-2012, 04:53 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
Re: Cannot find symbol error
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-22-2012, 05:23 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
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.
- 03-22-2012, 05:30 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
- 03-23-2012, 11:45 AM #12
Member
- Join Date
- Mar 2012
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Error: Cannot find symbol
By surendra0607 in forum New To JavaReplies: 3Last Post: 02-05-2012, 08:13 PM -
Error: Cannot Find Symbol
By mawright in forum New To JavaReplies: 4Last Post: 04-14-2011, 02:41 PM -
Cannot Find Symbol Error
By javadummy1 in forum New To JavaReplies: 6Last Post: 04-09-2011, 10:13 AM -
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
'Cannot find symbol' error
By minihazard10 in forum New To JavaReplies: 6Last Post: 10-10-2008, 04:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks