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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:10:47+00:00 2026-06-13T11:10:47+00:00

I have a jar file named stdlib-package , the .class files in this jar

  • 0

I have a jar file named stdlib-package, the .class files in this jar file are all in a edu.princeton.cs.introcs package

For example, I want to use one class named StdDraw from that jar file in my own codes

Say E:\code is my current working directory. like other conditions, I create a subdirectory bin\edu\princeton\cs\introcs to put stdlib-package in

Here is my codes:

package com.david.test;
import edu.princeton.cs.introcs.stdlib-package.*; // any problems here ?

public class DrawTest
{
    public static void main(String[] args)
    {
        StdDraw.line(0.5, 0.5, 1, 0.5);
    }
}  

Then I put DrawTest.java in the src\com\david\test

To compile the DrawTest.java, I type the commands in command line:

javac -d bin -cp bin\edu\princeton\cs\introcs\stdlib-package.jar src\com\david\test\DrawTest.java  

But it failed : package edu.princeton.cs.introcs.stdlib_package doesn’t exist…

I searched for a lot of time, but haven’t found the answer
Thanks for your help

EDIT===
@EJP’s comment solves my question too.

  • 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-13T11:10:47+00:00Added an answer on June 13, 2026 at 11:10 am

    This should be all you need in code:

    import edu.princeton.cs.introcs.*
    

    Then you only need to make sure the jar is on your class path; it doesn’t matter what the name of the jar is, or where it is. If it is on your classpath, Java will load it, and use the location of the files within it.

    Move the jar into a lib directory in your current directory, and do something like

    javac -cp lib\stdlib-package.jar src\com\david\test\DrawTest.javac
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jar file named stdlib.jar . This has many classes in its
I have a Jar file named OuterJar.jar that contains another jar named InnerJar.jar this
I have a jar file named umar.jar in /root/umar/bin directory. I have a shell
HI Guys I Have A jar File Named Column Reader. I am trying to
I have a jar file that I want to put in the shared lib
That is when you have any jar file attached to you your class path.
I have a external jar file named xxx.jar. I use xxx.jar in my GWT
I have jar files which I constructed using command jar -cf Generic.jar /java/mypackage/*.class There
I have a directory full of .jar files, named progressively like so: version-1.jar version-2.jar
I have a JAR file named helloworld.jar . In order to run it, I'm

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.