Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: classpath, .jar, and import statements

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Chandler, Arizona, USA
    My Mood
    Thanked 2 Times in 2 Posts

    Default classpath, .jar, and import statements

    I am trying to figure out how to take my .class files, put them in a .jar file, and then
    import the package into a .java file.

    So far, I have been able to create the .jar file, but I am seriously stuck now.
    My directory looks like this:


    According to info here:
    Setting the class path

    and here:
    Classpath (Java) - Wikipedia, the free encyclopedia

    I should be able to run the HelloWorld file from the command prompt . . .

    however here is all I get:


    I am getting nothing but the same message, no matter what I do,
    ad infinitum . . . Error: Could not find or load main class apk.pkg.HelloWorld

    As you can see in the command prompt image, >java HelloWorld works fine and prints out "This is a test".

    Where do I go from here???
    Windows 7, Java SE Runtime Environment 1.7.0_25 64-bit.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,618 Times in 2,568 Posts

    Default Re: classpath, .jar, and import statements

    Post the contents of the screen's here instead of images. The Find/Search commands and the Select and Copy command don't work with images.

    On windows: To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. I have a question about import statements
    By syedk01 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: August 27th, 2013, 07:47 AM
  2. Import if Import is Found, Else
    By blazedGinger in forum Java Theory & Questions
    Replies: 5
    Last Post: March 9th, 2013, 06:43 PM
  3. Replies: 0
    Last Post: April 14th, 2012, 11:22 AM
  4. [SOLVED] CLASSPATH environment variable
    By SPACE MONKEY in forum Java Theory & Questions
    Replies: 6
    Last Post: February 15th, 2011, 04:10 PM
  5. Problems in setting classpath
    By missyati in forum Java Theory & Questions
    Replies: 3
    Last Post: June 30th, 2009, 12:43 AM

Tags for this Thread