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 2 of 2

Thread: How do I use a class inside a library?

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How do I use a class inside a library?

    I have a class inside my projects library called 'customSwingControls.jar', the class I want to use is 'ProjectName/Libraries/CustomSwingControls.jar/Classes/customButton.class'. I want to use customButton.class as a type inside a parameter but I'm not sure how to properly do this (I don't know how to import the class).

    private void makeMove(customButton button){
    //code here
    }

    When I do this I receive an error over 'customButton' that says 'cannot find symbol'.


  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: How do I use a class inside a library?

    The jar file needs to be on the classpath
    and the code needs to import the package the class is in.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. HOW TO EDIT THE LIBRARY .CLASS FILE IN THE JAVA
    By kranthi24 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 21st, 2013, 06:46 AM
  2. HOW TO EDIT THE LIBRARY .CLASS FILE IN THE JAVA
    By kranthi24 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 21st, 2013, 06:46 AM
  3. Inside the Graphics class
    By Garaen in forum Java Theory & Questions
    Replies: 2
    Last Post: September 2nd, 2012, 09:31 PM
  4. How do you install a class library?
    By ConMan in forum Java Theory & Questions
    Replies: 1
    Last Post: June 7th, 2011, 12:57 AM
  5. [SOLVED] Passing arrayList inside class
    By KrisTheSavage in forum Collections and Generics
    Replies: 1
    Last Post: March 27th, 2010, 12:45 PM