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

Thread: How can I use this JAR file?

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How can I use this JAR file?

    Hello everybody, I am new here and new to Java, so please be patient if you can. I am trying to make a java project that will make use of a JAR file. The JAR file is called javaanpr.jar and is available in this package

    JavaANPR - Automatic number plate recognition system

    What I want to do should be pretty simple, I write my own java program that will send a jpeg to that JAR and get the result from it.

    Sadly, as I am a PHP coder, I do not have much java experience.

    From what I have seen on example programs, I need to reference the JAR in my build path and import the JAR, I have done both of these.

    I am now lost, so maybe somebody can give me some pointers?

    Thanks in advance


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

    Default Re: How can I use this JAR file?

    There is some confusion here on what a jar file is. It is like a zip file, it contains compressed files like images and class files. The java program can start the execution of one of the class files if there is a manifest file with a Main-Class entry that gives the name of the class to start execution.

    When you say you want to "send" an image file to the jar file, what does that mean?
    You can write a program that uses the classes contained in the jar file. If you add the jar file to the compiler's classpath and to the java program's classpath you can use classes from the jar file.

    Are you trying to write a java program that calls methods in the classes in the jar file?
    If you put the jar file on the classpath you will be able to do that.

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How can I use this JAR file?

    Quote Originally Posted by Norm View Post
    There is some confusion here on what a jar file is. It is like a zip file, it contains compressed files like images and class files. The java program can start the execution of one of the class files if there is a manifest file with a Main-Class entry that gives the name of the class to start execution.

    When you say you want to "send" an image file to the jar file, what does that mean?
    You can write a program that uses the classes contained in the jar file. If you add the jar file to the compiler's classpath and to the java program's classpath you can use classes from the jar file.

    Are you trying to write a java program that calls methods in the classes in the jar file?
    If you put the jar file on the classpath you will be able to do that.
    Hi Norm, thanks for your reply. Yes, I want to make a program that calls methods in the jar file.

    I have put the jar in my class path, but I need some help/tips on how I can now use it ( I am new to java so am a little lost )

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

    Default Re: How can I use this JAR file?

    how I can now use it
    You will have to ask the author(s) of the programs that are in the jar file. There should be some API doc available for how other programmers can use the classes in the jar file.

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How can I use this JAR file?

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/50848-how-do-i-use-jar-file.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


  6. #6
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How can I use this JAR file?

    Quote Originally Posted by Norm View Post
    You will have to ask the author(s) of the programs that are in the jar file. There should be some API doc available for how other programmers can use the classes in the jar file.
    I dont think there is any API documentation available. This means there is no way for me to use it?

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

    Default Re: How can I use this JAR file?

    This means there is no way for me to use it?
    Just about. The author would have published doc for the classes if (s)he had intended them to be usable outside of this jar file. Have you looked in the jar file to see if there is source or doc in there?
    You can use a zip file utility to see the contents of the jar file.

  8. #8
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How can I use this JAR file?

    Quote Originally Posted by Norm View Post
    Just about. The author would have published doc for the classes if (s)he had intended them to be usable outside of this jar file. Have you looked in the jar file to see if there is source or doc in there?
    You can use a zip file utility to see the contents of the jar file.
    I have all the source code of the JAR file, I guess it is best to read this source and try and figure out how it works?

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

    Default Re: How can I use this JAR file?

    Quote Originally Posted by IrishGirl View Post
    I have all the source code of the JAR file, I guess it is best to read this source and try and figure out how it works?
    Yes, that would be the way.
    There is a program that may be useful: javadoc will read the .java files and produce an outline of the classes and their methods and include some doc if the authors followed the recommended commenting.

Similar Threads

  1. Java I/O File code; how to read/write file
    By ryu2le in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 18th, 2011, 05:51 PM
  2. Replies: 10
    Last Post: January 12th, 2011, 05:48 AM
  3. insert(embed) a file object (.txt file) in MS excel sheet using java.
    By jyoti.dce in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 12th, 2010, 08:16 AM
  4. Inputing file (.txt) and finding the highest number in the file
    By alf in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 15th, 2010, 09:11 AM
  5. Replies: 8
    Last Post: January 6th, 2010, 09:59 AM