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 7839947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:36:28+00:00 2026-06-02T15:36:28+00:00

I have one java file for web Crowler. That gives me error like multiple

  • 0

I have one java file for web Crowler. That gives me error like multiple markers at line and some line number .

I am just learned the pattern and matcher. so i am unable to correct the error.

my code is

 import java.awt.*;
 import java.awt.event.*;
 import java.io.BufferedReader;
 import java.awt.*;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;


 class initComponents extends Frame implements ActionListener {

      // TextField addt  ,factorialt,concatt1,concatt2,lengtht,palindromet,comparet1,comparet2,substringt1,substringt2;
    //Button add1,factorial1,concat1,length1,palindrome1,compare1,substring1;
 String s1="";
//String s3="";
//String s4="";
//String s2="";
 Button Search,Clear;
 TextField text1;
 TextArea text2;
Label lab,lab1,lab2;

public initComponents()
{
        MyWindowAdapter1 m=new MyWindowAdapter1(this);
        addWindowListener(m);

        setTitle("Web Crawler");
        setLayout(null);
        setSize(1000,1000);
        setVisible(true);

        setBackground(Color.LIGHT_GRAY);

        lab=new Label("Name: ");
        text1=new TextField(20);
        //text2=new TextArea(80,80);
        text2=new TextArea();

       //lab1=new Label("Count");
       //lab2=new Label(); 

        Search=new Button("Search");
        Clear=new Button("Clear");

        lab.setBounds(50,50,80,20);
        //lab1.setBounds(500,50,80,20);
        //lab2.setBounds(590,50,250,20);

        text1.setBounds(140,50,250,20);
        Search.setBounds(50,100,80,20);
        Clear.setBounds(150,100,80,20); 
        text2.setBounds(50, 200, 700, 500);
        //text2.setBounds(200,100,80,20);

        add(lab);
        add(text1);
        //add(lab1);
        //add(lab2);
        add(Search);
        add(Clear);
        add(text2);


        setVisible(true);
        setSize(800,800);

        Search.addActionListener(this);
        Clear.addActionListener(this);



}


 public void actionPerformed(ActionEvent a) 
  {
// TODO Auto-generated method stub



if(a.getSource().equals(Clear))
{
    text1.setText("");
    text2.setText("");
    //text2.append("");
}

    if(a.getSource().equals(Search))
    {
        s1=text1.getText();

        text2.setText("");
        //text2.append();
        //web_crawler c=new web_crawler();

        //c.crawling(s1);


        try{
             InputStreamReader in = new InputStreamReader(new URL(s1).openStream());
             StringBuilder input = new StringBuilder();

             int ch;

             while ((ch = in.read()) != -1) 
                 input.append((char) ch);

             String patternString = "<a\\s+href\\s*=\\s*(\"[^\"]*\"|[^\\s>])\\s*>";


             String abc=((?<html>(href|src)\s*=\s*")|(?<css>url\())(?<url>.*?)(?(html)"|\));  **// here is error**
             Pattern pattern = Pattern.compile(abc, Pattern.CASE_INSENSITIVE);
             Matcher matcher = pattern.matcher(input);
             int count=0;
             String abc="";

             System.out.println(pattern);
             System.out.println(matcher.toString());

             while (matcher.find()) 
             {

                 int start = matcher.start();
                 int end = matcher.end();
                 String match = input.substring(start, end);

                 //match.matches();
             //jTextArea1.append(match);
             //jTextArea1.append("\n");

                 //String[] tokens=match.split(" ");


                 //System.out.println(tokens[0].toString());



                 text2.append(match);
                 text2.append("\n");
             }




            }
            catch (IOException e) 
            {
             e.printStackTrace();
            }
            catch (PatternSyntaxException e)
            {
             e.printStackTrace(); 
            }



    }

}

}

    class MyWindowAdapter1 extends WindowAdapter{
initComponents mf;
public MyWindowAdapter1(initComponents mf){
this.mf=mf;
}

public void windowClosing(WindowEvent we)
  {
      System.exit(0);
 } 
 }

it gives errors like

     Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: 
Syntax error on token "?", new expected
Syntax error on token ">", Type expected after this token
Syntax error on token "Invalid Character", invalid AssignmentOperator
Syntax error on token "Invalid Character", delete this token
Syntax error on tokens, Expression expected instead

at initComponents.actionPerformed(initComponents.java:115)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Please help me. Thanks

  • 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-02T15:36:29+00:00Added an answer on June 2, 2026 at 3:36 pm

    You need to add quotation marks around your literal and add the correct escape sequences. Also you declare String abc twice:

    String abc=((?<html>(href|src)\s*=\s*")|(?<css>url\())(?<url>.*?)(?(html)"|\));  **// here is error**
    Pattern pattern = Pattern.compile(abc, Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(input);
    int count=0;
    String abc=""; **redeclaration here**
    

    change it to:

    String abc="((?<html>(href|src)\\s*=\\s*\")|(?<css>url\\())(?<url>.*?)(?(html)\"|\\))";
    Pattern pattern = Pattern.compile(abc, Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(input);
    int count=0;
    abc="";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java webapp WAR file that depends on multiple jars in it's
I have a web application deployed in WebLogic. In one of my java file,
I have a web application, that contains a configuration xml file for one of
i have a really basic java program just one .java/.class file (.java uncompiled .class
I have a medium size Java file. Everytime I make a change to one
I have one java project in netBeans. There are some packages, and classes in
I have one application that prints messages from Test.exe in console .My java program
I just learned (the hard way) that Java Component s can only have one
I have created one application in flex that is accessing the Java webservice using
I have a Glassfish 3.1.1 web application for Java EE 6 running. one of

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.