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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 4 of 4

Thread: importing other classes

  1. #1
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default importing other classes

    I am trying to import the following which I found on the internet though it is not working, it has worked for others.
    I have put it right at the top where import statements go and I am getting a cannot be resolved error.
    import org.jdesktop.swingx.JXDatePicker;


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: importing other classes

    You need to have the class files that are in that package on the classpath when the code is compiled and executed. Often the class files are in a jar file. You need to find that jar file and put it on the classpath for the javac and java commands.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    keepStriving (December 11th, 2013)

  4. #3
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: importing other classes

    Quote Originally Posted by keepStriving View Post
    I am trying to import the following which I found on the internet though it is not working, it has worked for others.
    I have put it right at the top where import statements go and I am getting a cannot be resolved error.
    import org.jdesktop.swingx.JXDatePicker;
    JXDatePicker belongs to the SwingX library. Go to https://swingx.java.net/, and download the "SwingX 1.6.4 All - Binary" (1.6.4 is the latest version) which is a file swingx-all-1.6.4.jar

    This jar must be put "in classpath", how to do this depends on: a) if you compile/run from command prompt using JDK tools or b) if you use an IDE (Eclipse, NetBeans, etc...)
    Andrea, www.andbin.netSCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginnersMy new project Java Examples on Google Code

  5. The Following User Says Thank You to andbin For This Useful Post:

    keepStriving (December 11th, 2013)

  6. #4
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Re: importing other classes

    Thank you so much, I didn't know I had to actually download it, left me confused.

Similar Threads

  1. Replies: 10
    Last Post: April 7th, 2013, 05:42 PM
  2. Package Importing Help
    By sarwardnj in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 19th, 2013, 07:32 AM
  3. Importing images in Programs
    By n00b in forum AWT / Java Swing
    Replies: 6
    Last Post: November 4th, 2011, 11:09 AM
  4. importing class files :S
    By b3ard in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 2nd, 2010, 03:45 AM
  5. importing packages..
    By chronoz13 in forum Java IDEs
    Replies: 4
    Last Post: November 23rd, 2009, 05:49 PM