AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Issue with program ab
 
 

when using the ab.jar in eclipse I get the following error when trying to run the bot.
“Could not find class ‘org.alicebot.ab.Bot’, referenced from method…”. The chat class is being imported but the bot class cannot be imported.

Here is my code:

import org.alicebot.ab.Bot;
import org.alicebot.ab.Chat;

import android.annotation.SuppressLint;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
//import android.widget.ImageView;
//import android.widget.RelativeLayout;

public class MainActivity extends Activity {


 String usertext
String response;
 
String botname="MAVIS";
 
Bot mavis=new Bot(botname);
 
 
Chat chat= new Chat(mavis);
 
 @
Override
 
protected void onCreate(Bundle savedInstanceState{
  
// TODO Auto-generated method stub
  
super.onCreate(savedInstanceState);
  
setContentView(R.layout.activity_main); 
  final 
LinearLayout ll1 = (LinearLayoutfindViewById(R.id.ll1);
  final 
LinearLayout ll2 = (LinearLayoutfindViewById(R.id.ll2);
  final 
ScrollView scv = (ScrollViewfindViewById(R.id.sv);
  final 
Button btn = (ButtonfindViewById(R.id.button1);
  final 
EditText medit = (EditTextfindViewById(R.id.editText1);
  
  
  
  
  
  
btn.setOnClickListener(new View.OnClickListener() {
  
  
@SuppressLint("NewApi")
  @
Override
  
public void onClick(View v{
  
// TODO Auto-generated method stub
  //ImageView imgu=new ImageView(v.getContext());
  //ImageView imgb=new ImageView(v.getContext());
   
    
   
    
TextView tvu=new TextView(v.getContext());
    
TextView tvb=new TextView(v.getContext());
    
    
TextView tvut=new TextView(v.getContext());
    
TextView tvbt=new TextView(v.getContext());
    
    
TextView tvdivider1=new TextView(v.getContext());
    
TextView tvdivider2=new TextView(v.getContext());  
    
    final 
LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENTLayoutParams.WRAP_CONTENT);
    
    
//imgu.setLayoutParams(lparams);
    //imgb.setLayoutParams(lparams);
    
    
tvu.setLayoutParams(lparams);
    
tvb.setLayoutParams(lparams);
    
    
tvut.setLayoutParams(lparams);
    
tvbt.setLayoutParams(lparams);
    
    
tvdivider1.setLayoutParams(lparams);
    
tvdivider2.setLayoutParams(lparams);
    
        
    
usertext medit.getText().toString();
    if(
usertext.trim().length() != 0){
     
     ll1
.addView(tvu);
     
ll1.addView(tvb);
     
ll2.addView(tvut);
     
ll2.addView(tvbt);
     
ll1.addView(tvdivider1);
     
ll2.addView(tvdivider2);
     
     
//imgu.setImageResource(R.drawable.user);
     //imgb.setImageResource(R.drawable.user);
     
     
response=chat.multisentenceRespond(usertext);
     
     
tvu.setText("User");
     
tvb.setText(botname);
     
     
     
     
     
tvbt.setText(" : "response);
     
tvut.setText(" : "usertext);
     
medit.setText(" ");
     
     
tvdivider1.setText("   ");
     
tvdivider2.setText("   --------------------");
    
}
    else{
     
//do nothing
    
}
 }
 }
);
  
  
scv.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            
public void onGlobalLayout() {
                scv
.post(new Runnable() {
                    
public void run() {
                        scv
.fullScroll(View.FOCUS_DOWN);
                    
}
                }
);
            
}
        }
);
 
}

I have imported the external library and defined the classpath for it. I have also copied the ab.jar in my project folder and even defined the classpath for it. But nothing seems to be working. Am I doing this wrong or are there more libraries that are needed for this to work. Anybody have a solution to my problem?

 

 
  [ # 1 ]

I really don’t have any answer for this question. I am also going to start working on Java to create a chat bot. It would nice if you post the answer for this problem. Thanks.

 

 
  [ # 2 ]

As the post is 3 years old, I guess the poster either solved his problem or moved on…

 

 
  login or register to react