Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7887603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:37:22+00:00 2026-06-03T05:37:22+00:00

While writing my program I got cannot find symbol message when I tried to

  • 0

While writing my program I got “cannot find symbol message” when I tried to invoke the method setTextArea() from another class. After compiling the program I am getting the following error message:
Uncompilable source code – Erroneous sym type: gui.setTextArea

Here is my code:

public class LinkExtractor {

    public static void main(String[] args) throws IOException {
        //Validate.isTrue(args.length == 1, "usage: supply url to fetch");
        String base = "http://uk.ask.com/web?q=";
        String keyword ="flowers";
        String tale="&search=&qsrc=0&o=312&l=dir";
        String url =base+keyword+tale;

        print("Fetching %s...", url);

        Document doc = Jsoup.connect(url).get();
        Elements links = doc.select("a[href]");

        print("\nLinks: (%d)", links.size());
        for (Element link : links) {
            print(" * a: <%s>  (%s)", link.attr("abs:href"), trim(link.text(), 35));
      AssistantGUI gui=new AssistantGUI();

        }
    }

    public static void print(String msg, Object... args) {
      ***//here is the problem line***
        gui.setTextArea(String.format(msg, args));

    }

    private static String trim(String s, int width) {
        if (s.length() > width)
            return s.substring(0, width-1) + ".";
        else
            return s;
    }
}

And here is my second class:

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class AssistantGUI {
JFrame frame= new JFrame("TextArea frame");
JPanel panel=new JPanel();
JTextArea text= new JTextArea("",5,20);


public AssistantGUI(){

frame.add(panel);
panel.add(text);
frame.setSize(250,200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}
public void setTextArea(String myString){
text.append(myString);
}
public static void main(String[] args){
AssistantGUI gui= new AssistantGUI();

gui.setTextArea("Hello");
}

}

I read many posts with a similar issue, but couldn’t find a solution. Everything looks fine to me. I am creating an instance of AssistantGUI and then I am using it to call the method setTextArea(), why it does not recognise it? Any ideas? I will really appreciate your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:37:24+00:00Added an answer on June 3, 2026 at 5:37 am

    There is now a correct answer of @RameshK. In Object Oriented style: do something like this (making things non-static):

    AssistantGUI gui = new AssistantGUI();
    
    public static void main(String[] args) throws IOException {
        new LinkExctractor().execute();
    }
    
    private void execute() {
        //Validate.isTrue(args.length == 1, "usage: supply url to fetch");
        String base = "http://uk.ask.com/web?q=";
        String keyword ="flowers";
        String tail = "&search=&qsrc=0&o=312&l=dir";
        String url = base + keyword + tail;
    
        print("Fetching %s...", url);
    
        Document doc = Jsoup.connect(url).get();
        Elements links = doc.select("a[href]");
    
        print("\nLinks: (%d)", links.size());
        for (Element link : links) {
            print(" * a: <%s>  (%s)", link.attr("abs:href"), trim(link.text(), 35));
        }
    }
    
    private void print...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got stuck with a performance problem while writing my program and I need
I've run into this while writing a Traveling Salesman program. For an inner loop,
Writing a python program, and I came up with this error while using the
While writing some views to respond to ajax requests i find it somewhat strange
I've got a GUI C++ program that takes a shell command from the user,
I've got an event-driven network server program. This program accepts connections from other processes
I'm busy writing a Program that Transmits GPS Coordinates to a Server from a
I was writing a simple genetic program to test out the process, but got
I'm writing a Python program for fun but got stuck trying to import a
I am writing a very simple program that removes duplicate chars from a string.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.