Dear Zulfi,

In your pom, add a dependency

----
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>ValidateEmail4</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
   * <dependencies>*





*    <dependency>            <groupId>commons-validator</groupId>
  <artifactId>commons-validator</artifactId>
<version>1.7</version>            <type>jar</type>        </dependency>*
   * </dependencies>*
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>

<exec.mainClass>com.mycompany.validateemail4.ValidateEmail4</exec.mainClass>
    </properties>
</project>
----

[image: image.png]
This will have been pointed out by a yellow +red bulb in the left gutter in
de IDE-editor when you look at the source code of the failing file. (line
11)
When you click on that bulb, you get a menu to let netbeans search for a
dependency. IF you wait a little, it will find a matching dependency, THen
one you see in the pom file.
Let the IDE add that to the pom file and you are done.

Met vriendelijke groet,
Pieter van den Hombergh.
Kerboschstraat 12
5913 WH Venlo


On Thu, Mar 28, 2024 at 6:25 AM Zulfi Khan <zulfi6...@yahoo.com.invalid>
wrote:

> Compilation error: Email Validation program using Apache class
> org.apache.commons.validator.routines.EmailValidator
>
>
> 1package com.mycompany.validateemail4;
>
> 2//import org.apache.commons.validator.EmailValidator;
>
> 3import java.util.logging.Level;
>
> 4import java.util.logging.Logger;
>
> 5//import org.apache.commons.validator.*;
>
> 6//import org.apache.commons.validator.routines.InetAddressValidator;
>
> 7import org.apache.commons.validator.routines.EmailValidator;//package
> import org.apache.commons.validator.routines does not exist
>
> 8//import org.apache.commons.validator.routines.EmailValidator;
>
> 9//Latest:
> https://emaillistvalidation.com/blog/mastering-email-validation-with-apache-commons-validator-a-comprehensive-guide/
>
> 10import java.util.regex.Matcher;
>
> 11import java.util.regex.Pattern;
>
> 12import javax.swing.JOptionPane;
>
> 13import javax.swing.UnsupportedLookAndFeelException;
>
> 14public class EmailInputFrame extends javax.swing.JFrame {
>
>
> /**
>
> * Creates new form EmailInputFrame
>
> */
>
> 15 public EmailInputFrame() { }
>
>
> 16 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
>
> 17 // TODO add your handling code here:
>
> 18 String emailAddress= jTFEmail.getText();
>
> 19 //
> https://stackoverflow.com/questions/7169991/emailaddress-validation-in-java
>
> 20 //
> https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/EmailValidator.html
>
> 21 EmailValidator validator = EmailValidator.getInstance();//Can't find
> symbol EmailValidator
>
> 22 }
>
>
> Hi,
>
> I am getting two compilation errors with email validation program using
> “Apache import org.apache.commons.validator.EmailValidator class”.
>
> One error is on line#7:
>
> 7import org.apache.commons.validator.routines.EmailValidator;//package
> import org.apache.commons.validator.routines does not exist
>
>
> and the other error is on line 21:
>
> 21 EmailValidator validator = EmailValidator.getInstance();//Can't find
> symbol EmailValidator
>
>
> Compilation Message:
>
> Compiling 2 source files with javac [debug target 11] to target/classes
> -------------------------------------------------------------
> COMPILATION ERROR :
> -------------------------------------------------------------
> com/mycompany/validateemail4/EmailInputFrame.java:[11,45] package
> org.apache.commons.validator.routines does not exist
> com/mycompany/validateemail4/EmailInputFrame.java:[93,11] cannot find
> symbol
>   symbol:   class EmailValidator
>   location: class com.mycompany.validateemail4.EmailInputFrame
> com/mycompany/validateemail4/EmailInputFrame.java:[93,38] cannot find
> symbol
>   symbol:   variable EmailValidator
>   location: class com.mycompany.validateemail4.EmailInputFrame
> 3 errors
> -------------------------------------------------------------
> ------------------------------------------------------------------------
> BUILD FAILURE
> ------------------------------------------------------------------------
> Total time:  1.603 s
> Finished at: 2024-03-28T00:22:40-05:00
> ------------------------------------------------------------------------
> Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile
> (default-compile) on project ValidateEmail4: Compilation failure:
> Compilation failure:
> com/mycompany/validateemail4/EmailInputFrame.java:[11,45] package
> org.apache.commons.validator.routines does not exist
> com/mycompany/validateemail4/EmailInputFrame.java:[93,11] cannot find
> symbol
>   symbol:   class EmailValidator
>   location: class com.mycompany.validateemail4.EmailInputFrame
> com/mycompany/validateemail4/EmailInputFrame.java:[93,38] cannot find
> symbol
>   symbol:   variable EmailValidator
>   location: class com.mycompany.validateemail4.EmailInputFrame
> -> [Help 1]
>
> To see the full stack trace of the errors, re-run Maven with the -e switch.
> Re-run Maven using the -X switch to enable full debug logging.
>
>
> Somebody please guide me, projectattached.
>
>
> Zulfi.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to