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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:51:42+00:00 2026-05-20T10:51:42+00:00

I created a two class named Vendor and Address in one file called business.groovy(that

  • 0

I created a two class named Vendor and Address in one file called business.groovy(that is I created package using the name business)
And in the same folder I created another groovy code that imports the business package and make use of Vendor class attributes(Vendor is class in business package). But when I try to create a object for Vendor in that groovy script, it throwing error stating that:

/home/Anto/Groovy/pakg/Imports.groovy: 2: unable to resolve class Vendor
@ line 2, column 13.
def canoo = new Vendor()

What do I have to do? Where did I go wrong?

These are the files I created:
business.groovy

package business
class Vendor {
public String name
public String product
public Address address = new Address()
}
class Address {
public String street, town, state
public int zip
}

impotTesting.groovy

import business.*
def canoo = new Vendor()
canoo.name = 'Canoo Engineering AG'
canoo.product = 'UltraLightClient (ULC)'

And when I try to execute the importTesting.groovy file by using groovy importTesting command, I get the error as I mentioned before!

  • 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-05-20T10:51:43+00:00Added an answer on May 20, 2026 at 10:51 am

    I would suggest you to either use some build tool like Ant or Gradle, or IDE like IntelliJ IDEA to control your classpath/compilation/runtime needs.

    EDIT: It should be like that:

    baseDir/business/business.groovy
    baseDir/impotTesting.groovy
    

    Your compiled classes should also resemble the same directory structure:

    baseDir/business/business*.class  
    baseDir/impotTesting*.class
    

    Then your baseDir should be added to the CLASSPATH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one class named investmentdetails. I created two different controls for displaying separate
i had created a class with two properties one of datetime datatype and other
I've created a Vector2D class that extends Point2D.Double . A Vector2D has two fields:
I have created a WPF application (named Ferhad.Wpf). Then I added two class libraries
I have two files say file1.php and file2.php. I have one php file named
I have two django models like these : class Place(models.Model): name = models.CharField(max_length=50) address
Here is the code, I defined two class named Father and Son, and create
Let's say I have created two objects from class foo and now want to
I've created two entities (simplified) in C#: class Log { entries = new List<Entry>();
I'm currently experimenting with decorators. I created a Tank class and two decorators: DoubleGunTank

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.