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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:14:40+00:00 2026-06-09T20:14:40+00:00

I am trying to get Google Closure Compiler to work to compile my javascript

  • 0

I am trying to get Google Closure Compiler to work to compile my javascript code that uses Jquery but i keep getting variable $ is undeclared is there a way to get it to see the $ variable. Is there a way for closure Compiler to see the Jquery library but not compile it.
here is my ant script

<?xml version="1.0"?>
<project basedir="." default="compile">

<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
       classpath="build/compiler.jar"/>

<target name="compile">

<jscomp compilationLevel="simple" warning="verbose" 
        debug="false" output="output/file.js">

  <sources dir="${basedir}/src">
    <file name="js.js"/><!-- the file I'm trying to compile -->
  </sources>

</jscomp>

</target>

</project>

My Jquery library is called min.js and its in the src folder with js.js

I’m sure this is a easy question but I’m just missing something. Thanks in advance!

  • 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-09T20:14:41+00:00Added an answer on June 9, 2026 at 8:14 pm

    You need to include the jQuery externs. Each major version of jQuery has its own extern file. You can find them at http://code.google.com/p/closure-compiler/source/browse/#svn%2Ftrunk%2Fcontrib%2Fexterns

    Once you’ve downloaded the appropriate extern, here’s how you would reference it while compiling:

    <?xml version="1.0"?>
    <project basedir="." default="compile">
    
    <taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
           classpath="build/compiler.jar"/>
    
    <target name="compile">
    
    <jscomp compilationLevel="simple" warning="verbose" 
        debug="false" output="output/file.js">
    
      <sources dir="${basedir}/src">
        <file name="js.js"/><!-- the file I'm trying to compile -->
      </sources>
    
      <externs dir="${basedir}/src">
        <file name="jquery-1.7.js"/>
      </externs>
    </jscomp>
    
    </target>
    

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

Sidebar

Related Questions

I'm trying to get Code Closure to work, but unfortunately, there's always an error
I'm trying to use the Google Closure Compiler to split my application code based
I'm trying to get google glog to work with windows, but I get these
I'm trying to get Google Analytics Code to work on the thank-you page after
I'm trying to get Google maps working for my project but i keep on
I've been trying to get a certain Google API to work for two days
I have been trying since yesterday to get google like paging, but each time
I'm trying to get an auto-suggest like Google has but without the dropdown. By
I'm trying to get the django-cms to work on google-app-engine. Did anyone succeed in
I've been trying to get Google Analytics to work in PhoneGap 1.2.0 over Android

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.