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

  • Home
  • SEARCH
  • 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 8846935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:06:39+00:00 2026-06-14T12:06:39+00:00

When adding an external JavaScript library to an Eclipse project should I be adding

  • 0

When adding an external JavaScript library to an Eclipse project should I be adding the .js file (d3.v2.js), or the tarballed master pulled from Github?

Google tells me to Google it. Subsequent Googles remind me of the need to Google it.


Directory tree:

.
 |-build
 |---classes
 |-src
 |-WebContent
 |---foo.html
 |---META-INF
 |---WEB-INF
 |-----lib
 |---d3
 |-----d3.v2.js

Relative path from foo.html to d3.v2.js should be: “../d3/d3.v2.js”

  • But, maybe it’s not. I don’t know.
  • Whenever I reference d3.v2.js from foo.html nothing happens. By nothing happens, I mean nothing visually appears in the browser which suggests that d3.js even exists.

To ‘add’ d3.v2.js to Eclipse I took the following steps:

  1. Foo -> New -> JavaScript Source File -> Advanced -> Link to File in Filesystem -> /home/tyler/workspace/foo/d3/d3.v2.js

  2. Tried 5 different paths. None of them worked (do you have to use relative, absolute?)

    • src=”/home/tyler/workspace/Foo/d3/d3.v2.js”
    • src=”../d3/d3.v2.js”
    • src=”/Foo/d3/d3.v2.js”
    • src=”d3.v2.js”
  3. So, I deleted the reference to d3.v2.js in Eclipse and attempted to add as a library.

  4. Foo -> JavaScript Resources -> Add JavaScript Library -> User Library – Configure User Libraries -> New -> “D3” -> Add .js file -> d3.v2.js (location: /home/tyler/workspace/Snotra/d3

  5. Tried a bunch of paths.

    • src=”d3.v2.js”
    • src=”../d3/d3.v2.js”
    • src=”/Foo/d3/d3.v2.js”

      1. Rinse, repeat.

Any ideas? I know that this is really easy, but I just don’t understand the fundamentals of adding JavaScript libraries to Eclipse.

foo.html

<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html" charset="utf-8" />
            <title>Tyler J. Fisher</title>
            <link rel="stylesheet" href="master.css" />
        <script type="text/javascript" src="../d3/d3.v2.js"></script>
    </head>

    <body>
         <section id="foo_view">
            <script type="text/javascript">
                            document.write("test"); <!--Works-->
                var dataset[1,2,3,4,5];
                d3.select("body").selectAll("p") <!--Doesn't work-->
                    .data(dataset)
                    .enter()
                    .append("p")
                    .text("RABBLE");
        </script>
     </section>
    </body>
</html>

document.write(“test”); works.

The d3.js code doesn’t.

So (maybe):

  • The relative path must be off (or maybe I have to use absolute paths)
  • Tomcat6 isn’t serving JavaScript properly (due to human error)
  • Eclipse isn’t serving JavaScript properly (due to human error)
  • 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-14T12:06:40+00:00Added an answer on June 14, 2026 at 12:06 pm

    What Eclipse deploys to Tomcat is what is inside WebContent. If your JS files are not in WebContent, they won’t be part of the deployed web app.

    You need to understand that what Eclipse shows you is you development, source folders. What is deployed is not this folder, but a directory structure conforming the Java EE specs:

    • Everything in WebContent is part of the deployed archive
    • The Java source files are compiled and stored in the WEB-INF/classes of the deployed archive
    • The non-Java files under a source directory ar copied to the WEB-INF/classes of the deployed archive
    • All the other files are not part of the deployed archive.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to execute Javascript from an external javascript library (which I left in
What is the correct syntax for adding an external reference to a JavaScript file
I am adding an external CSS file and an external JS file to my
How can I go through all external links in a div with javascript, adding
Suppose we have a user library project ProjectUserlib that uses an external jar external.jar,
im currently working on adding content to an external ajax file being loaded with
I have the following code in an external JavaScript file that is called within
What is the best way of adding external files from a partial view? I
What difference between adding library by add external jar and putting those jars to
I am adding some external JavaScript to the end of the page via my

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.