Results 1 to 12 of 12
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default where i put my jar file in my system?

    Hello
    I am using jdk1.6_11 version.
    but i could nt import javax.servlet package.
    So i have download servlet jar from internet but i dont know where i put this jar file in my system to run servlet programs?

    Thanks a lot for advance.
    Mak
    (Living @ Virtual World)

  2. #2
    hardiks21 is offline Member
    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Default

    You just have to set a path variable in your environment settings.
    Add a path of your jar file in your "PATH" variable.

  3. #3
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default How to add a jar file

    I have just gone through the frustrating exercise of trying to add a jar file to my computer. For Windows systems, the jar file has to explictly listed in the CLASSPATH environment variable. For example, if I want to add a jar file (mail.jar) so it can be used by my Java programs, I would have to add the following to my CLASSPATH:
    C:\Program Files\Java\jdk1.6.0_02\bin\mail.jar
    This is where the the jar file is located.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Yep, locating all the jar files in a common place is really nice work. Even in later easy to find those libraries if you want.

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I noticed you are using javax.servlet, which indicates you are using a Web application server. I assume you want to access the classes in the JAR from your Web application

    Web application servers run your application for you, and they have very particular places were everything goes, including JAR files. Since the javax.servlet JAR is likely to be used by many applications, it makes more sense to load it in the WAS /common/lib directory, which is shared by all applications. If you have a JAR that is specific to your application, there is typically a /lib folder in your application structure where the JAR file goes.

    Look at the documentation for your WAS. They are normally very good about telling you where to put things.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    If you are include jar files in lib folder, that jar file is specific to a project, not for all right?

  7. #7
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Actually, at least on Tomcat, there are at least three types of /lib folders. Unfortunately, I don't have my Tomcat virtual machine available right now, so I'm going by memory, and I'm sure to give some wrong names...
    • /shared/lib is for JAR's shared by applications and the server itself. Don't use this folder unless you have a good reason and you know what you are doing
    • /common/lib is for JAR's shared by all applications
    • I can't remember the parent directory name, but each application has a /lib directory in the application resources directory. This is for application specific JAR's

    Just as well that I don't remember the exact names. I'm sure they are dependent on the WAS. Bottom line, read the documentation.

  8. #8
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default

    Hello thanks a lot for your response..
    can u tell me a exact path for that..
    i am waiting for your valuable reply
    Mak
    (Living @ Virtual World)

  9. #9
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Mak, the path depends on which WAS you are using, what OS it is installed on, where it was installed, and how it was configured.

    All I can suggest is to look at the WAS documentation, which will almost always tell you exactly where to put things. After you read the documentation, if you can, find someone who knows about this server and have them show you around.

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Steve11235 View Post
    Actually, at least on Tomcat, there are at least three types of /lib folders. Unfortunately, I don't have my Tomcat virtual machine available right now, so I'm going by memory, and I'm sure to give some wrong names...
    • /shared/lib is for JAR's shared by applications and the server itself. Don't use this folder unless you have a good reason and you know what you are doing
    • /common/lib is for JAR's shared by all applications
    • I can't remember the parent directory name, but each application has a /lib directory in the application resources directory. This is for application specific JAR's

    Just as well that I don't remember the exact names. I'm sure they are dependent on the WAS. Bottom line, read the documentation.
    Thanks a lot for the info lol.

  11. #11
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    More than you bargained for, huh?

    The application folder is WEB-INF/lib. WEB-INF/class is the root of the application CLASSPATH, for classes that are not put in JAR's.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. Listing file system from root directory
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 04-18-2009, 10:03 AM
  2. File System
    By Zosden in forum Advanced Java
    Replies: 3
    Last Post: 07-26-2008, 04:33 AM
  3. How to display a file system in a JTree view
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:43 PM
  4. Accessing client file system
    By revathi17 in forum New To Java
    Replies: 1
    Last Post: 10-17-2007, 10:17 AM
  5. Disk File System Access and Monitoring
    By drveresh in forum Advanced Java
    Replies: 1
    Last Post: 07-03-2007, 02:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •