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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:22:50+00:00 2026-05-28T00:22:50+00:00

I have a Java class which is located in src/java that references classes from

  • 0

I have a Java class which is located in src/java that references classes from an external JAR. I copied the JAR file to the lib directory. When I go to run the app using grails run-app I get an error that it can’t find the imported class.

What is the correct location to put JARs for a Grails project? Is there some special command to get Grails to recognize the newly added JAR files?

I am running Grails 2.0.0 with Java 1.6.0_29 on OS X.

Follow-up: The JARs are question are from Apache HttpComponents. More specifically:

commons-codec-1.4.jar
commons-logging-1.1.1.jar
httpclient-4.1.2.jar
httpclient-cache-4.1.2.jar
httpcore-4.1.2.jar
httpmime-4.1.2.jar

The class files in them are compiled to Java 1.3, which shouldn’t be a problem.

~/temp/org/apache/http $ file HttpResponse.class 
HttpResponse.class: compiled Java class data, version 47.0 (Java 1.3)
  • 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-28T00:22:50+00:00Added an answer on May 28, 2026 at 12:22 am

    The correct way to add jar’s is by adding it to your “BuildConfig.groovy”. You can specify if it is needed at compile time, runtime etc. For example:

    dependencies {        
            build 'org.apache.httpcomponents:httpcore:4.1.2' 
            build 'org.apache.httpcomponents:httpclient:4.1.2' 
            runtime 'org.apache.httpcomponents:httpcore:4.1.2'
            runtime 'org.apache.httpcomponents:httpclient:4.1.2'
    } 
    

    Please note, you may also need to uncomment the mavenCentral() line in your Buildconfig.groovy in order for the dependencies to get resolved.

    See “Dependency Resolution” section here.

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

Sidebar

Related Questions

I call a class which is located somewhere in a jar file (using java
I have two Java classes: B, which extends another class A, as follows :
I have a Java class which can be called from shell. (via java [command][options])
I have java class with a method which gets an image from a website:
I have an applet which contains some images, regular java classes and class, which
I have got the following code in a file called test.java which is located
I have a class library project which contains a java script file libscript.js which
I have a jar compiled with core jdk. It contains a java class which
I have a java class that uses complex static fields which need special operations
I have a java class which fires custom java events. The structure of the

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.