Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. trying to find the real import files

trying to find the real import files

Scheduled Pinned Locked Moved Java
questioncsharpjavavisual-studiotools
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tiwal
    wrote on last edited by
    #1

    Hello everybody. I am a newbie in Java and I am going to pose a question which may sound silly to most of you , but I run through the whole forum and article list without being able to find a hint. I have an error in my code which makes me think I do not have, in my classpath, the files needed for my "java.nio.*" import . Figuring my guess is right , how can I know , for any of the packages I import in my project, where the related files are ? And, which kind of files are they ? for instance , if I am importing the "java.net.*" or "the "java.io.*" packages, are they included in ".jar" files or not ? and where are the related containing files ? Is there a correspondence rule between the dotted import name form ( package.subpackage1.subpackage2....subpackageN.* ...) and a folder hierarchy somewhere in the filesystem ? I am using the Netbeans IDE, and I already checked the Tools|Library section, which includes a lot of .jar files, but only for a few of them I've been able to find the related .jar files. I read a lot of tutorials, manuals ,books and articles about the subject without finding a clear answer to these questions. Thank you

    L O 2 Replies Last reply
    0
    • T tiwal

      Hello everybody. I am a newbie in Java and I am going to pose a question which may sound silly to most of you , but I run through the whole forum and article list without being able to find a hint. I have an error in my code which makes me think I do not have, in my classpath, the files needed for my "java.nio.*" import . Figuring my guess is right , how can I know , for any of the packages I import in my project, where the related files are ? And, which kind of files are they ? for instance , if I am importing the "java.net.*" or "the "java.io.*" packages, are they included in ".jar" files or not ? and where are the related containing files ? Is there a correspondence rule between the dotted import name form ( package.subpackage1.subpackage2....subpackageN.* ...) and a folder hierarchy somewhere in the filesystem ? I am using the Netbeans IDE, and I already checked the Tools|Library section, which includes a lot of .jar files, but only for a few of them I've been able to find the related .jar files. I read a lot of tutorials, manuals ,books and articles about the subject without finding a clear answer to these questions. Thank you

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      tiwal wrote:

      I have an error in my code which makes me think I do not have, in my classpath, the files needed for my "java.nio.*" import

      What evidence do you have that leads to this conclusion? The nio package is part of the satndard runtime in rt.jar and should be installed as part of the Java installation.

      Veni, vidi, abiit domum

      T 1 Reply Last reply
      0
      • L Lost User

        tiwal wrote:

        I have an error in my code which makes me think I do not have, in my classpath, the files needed for my "java.nio.*" import

        What evidence do you have that leads to this conclusion? The nio package is part of the satndard runtime in rt.jar and should be installed as part of the Java installation.

        Veni, vidi, abiit domum

        T Offline
        T Offline
        tiwal
        wrote on last edited by
        #3

        In effect, actually no evidence at all, Richard, it's just a suspicion I made up by reading some documentation on the net. But if you say, as I originally thought, that "java.nio.*" is already in the standard runtime, that means my suspicion is wrong. Anyway, talking in general, is it possible to determine what is (and where is located) the .jar file where a particular import package in contained ?

        L 1 Reply Last reply
        0
        • T tiwal

          In effect, actually no evidence at all, Richard, it's just a suspicion I made up by reading some documentation on the net. But if you say, as I originally thought, that "java.nio.*" is already in the standard runtime, that means my suspicion is wrong. Anyway, talking in general, is it possible to determine what is (and where is located) the .jar file where a particular import package in contained ?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          tiwal wrote:

          where a particular import package in contained ?

          The majority are in the file rt.jar which is in the Java/jrex/lib directory. You can list all the individual jar files by going to that directory and running the command jar tvf rt.jar. As to your problem, it is much better to gather full diagnostic information rather than making guesses.

          Veni, vidi, abiit domum

          T 1 Reply Last reply
          0
          • L Lost User

            tiwal wrote:

            where a particular import package in contained ?

            The majority are in the file rt.jar which is in the Java/jrex/lib directory. You can list all the individual jar files by going to that directory and running the command jar tvf rt.jar. As to your problem, it is much better to gather full diagnostic information rather than making guesses.

            Veni, vidi, abiit domum

            T Offline
            T Offline
            tiwal
            wrote on last edited by
            #5

            thanks for your support. I'll follow your advices. regards

            1 Reply Last reply
            0
            • T tiwal

              Hello everybody. I am a newbie in Java and I am going to pose a question which may sound silly to most of you , but I run through the whole forum and article list without being able to find a hint. I have an error in my code which makes me think I do not have, in my classpath, the files needed for my "java.nio.*" import . Figuring my guess is right , how can I know , for any of the packages I import in my project, where the related files are ? And, which kind of files are they ? for instance , if I am importing the "java.net.*" or "the "java.io.*" packages, are they included in ".jar" files or not ? and where are the related containing files ? Is there a correspondence rule between the dotted import name form ( package.subpackage1.subpackage2....subpackageN.* ...) and a folder hierarchy somewhere in the filesystem ? I am using the Netbeans IDE, and I already checked the Tools|Library section, which includes a lot of .jar files, but only for a few of them I've been able to find the related .jar files. I read a lot of tutorials, manuals ,books and articles about the subject without finding a clear answer to these questions. Thank you

              O Offline
              O Offline
              Oscar0
              wrote on last edited by
              #6

              The direct answer to your question is yes, there is a direct correspondence between the dotted package names and the directory hierarchy. So for example, "java.nio.Buffer" is found in the directory "java/nio" and the file the loader looks for (in that directory) is called: "Buffer.class". What directory? you ask. The answer is any and all directories in the classpath are candidates (that includes jar files). A jar file is nothing more than a zip file with a different file extension. So open "rt.jar" in Winzip (or whatever zip file viewer you have lying around. In there you will see all the standard Java library directories, like "javax/swing/tree", "java/awt/font" etc. (these would correspond to packages javax.swing.tree.*, java.awt.font.*). And in the directory "java/nio" you should find all the java.nio files. EDIT: by the way, rt.jar is found in the jre/lib directory. So in Windows that would be "/Program Files/Java/jre/lib" or "/Program Files/Java/jdk/jre/lib"

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups