while using javac -classpath some.jar some.java (Where does classpath get stored?)

Discussion in 'Java' started by Gabe, Aug 27, 2004.

  1. Gabe

    Gabe Guest

    I hope I don't leave any vital information out.

    The OS I'm XP SP1a.
    the JDK version is SE v1.4.2_02

    I'm new to Java and I was using the tutorial provided on the
    java.sun.com site.
    Specifically:http://java.sun.com/docs/books/tutorial/ext/basics/install.html

    I tried javac -classpath some.jar some.java

    The jar and the java file both being in the same dir and I having
    navigated to that dir through the commandline console.

    Having successfully compiled I wanted to try doing it, using the
    <JAVA_HOME>\jre\lib\ext instructions given in the tutorial as an
    alternative to using -classpath.

    Thinking that setting the classpath in that fashion was temporary and
    would live as long as the commandline console was open, I closed the
    commandline console and I could still run the some.class file and
    recompile it without giving it the classpath. Something I did not
    think I would be able to do.

    Thinking that it was in memory, I restarted the system and logged in
    again to XP and I could still run and recompile the said .java file.

    I then went into my environment variable by right clicking on "my
    computer" and going to propeties>Advanced Tab>Environment Variable
    button and I could not fine classpath as an environment variable.

    Where does this env var get stored? I looked in the registry also,
    and it was not there. Is there some java meta file that this
    information is stored in.

    All I want to do is blow it away so that I can the test the
    <JAVA_HOME>\jre\lib\ext part of the tutorial.

    I appreciate your anticipated patients with me.

    Respectfully,
    Gabe
     
    Gabe, Aug 27, 2004
    #1
    1. Advertising

  2. Gabe

    Cid Guest

    On 26 Aug 2004 20:24:35 -0700, (Gabe)
    wrote:

    >I hope I don't leave any vital information out.
    >
    >The OS I'm XP SP1a.
    >the JDK version is SE v1.4.2_02
    >
    >I'm new to Java and I was using the tutorial provided on the
    >java.sun.com site.
    >Specifically:http://java.sun.com/docs/books/tutorial/ext/basics/install.html
    >
    >I tried javac -classpath some.jar some.java
    >
    >The jar and the java file both being in the same dir and I having
    >navigated to that dir through the commandline console.


    You haven't, by chance left the class files from some.jar sitting
    around in the same directory as some.java after making some.jar have
    you? (this assumes all these classes are in the default package -
    seems like that's how the tutorial worked)
     
    Cid, Aug 27, 2004
    #2
    1. Advertising

  3. Gabe

    Gabe Guest

    Cid <> wrote in message news:<>...
    > On 26 Aug 2004 20:24:35 -0700, (Gabe)
    > wrote:
    >
    > >I hope I don't leave any vital information out.
    > >
    > >The OS I'm XP SP1a.
    > >the JDK version is SE v1.4.2_02
    > >
    > >I'm new to Java and I was using the tutorial provided on the
    > >java.sun.com site.
    > >Specifically:http://java.sun.com/docs/books/tutorial/ext/basics/install.html
    > >
    > >I tried javac -classpath some.jar some.java
    > >
    > >The jar and the java file both being in the same dir and I having
    > >navigated to that dir through the commandline console.

    >
    > You haven't, by chance left the class files from some.jar sitting
    > around in the same directory as some.java after making some.jar have
    > you? (this assumes all these classes are in the default package -
    > seems like that's how the tutorial worked)


    The answer to that questions would be yes. The class file from
    some.jar is sitting around in the same dir as some.java after making
    some.jar.

    Is this is why the classpath data appears to be persistent but it
    really isn't stored anywhere after cleaning up memory through exiting
    the command line console or restarting the OS?

    In my mind, because the sdk is behaving a certain way, the data giving
    instructions for this behavior has to live somewhere.

    Let me know...your help is much appreciated.
     
    Gabe, Aug 27, 2004
    #3
  4. Gabe

    Cid Guest

    On 27 Aug 2004 05:01:40 -0700, (Gabe)
    wrote:

    >Cid <> wrote in message news:<>...
    >> On 26 Aug 2004 20:24:35 -0700, (Gabe)
    >> wrote:
    >>
    >> >
    >> >The jar and the java file both being in the same dir and I having
    >> >navigated to that dir through the commandline console.

    >>
    >> You haven't, by chance left the class files from some.jar sitting
    >> around in the same directory as some.java after making some.jar have
    >> you? (this assumes all these classes are in the default package -
    >> seems like that's how the tutorial worked)

    >
    >The answer to that questions would be yes. The class file from
    >some.jar is sitting around in the same dir as some.java after making
    >some.jar.
    >
    >Is this is why the classpath data appears to be persistent but it
    >really isn't stored anywhere after cleaning up memory through exiting
    >the command line console or restarting the OS?


    Yes it is. If I understand your setup correctly, you've got
    folder A
    some.java
    some.class
    some.jar

    and some.jar contains some.class?


    So you could invoke

    java -classpath some.jar some
    This invokes some.class in some.jar

    java some
    This invokes some.class in folder A


    Or maybe you have another class involved, a test driver - test.class
    with the main method? And assuming it references the some via default
    package, it will find some.class in the folder if you don't specify
    some.jar as the classpath.
     
    Cid, Aug 27, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tasos Kotsikonas

    Calling javac and jar from a Java class

    Tasos Kotsikonas, Nov 17, 2003, in forum: Java
    Replies:
    3
    Views:
    2,781
    Roedy Green
    Nov 17, 2003
  2. Oliver Wong
    Replies:
    12
    Views:
    1,497
    Roedy Green
    Dec 10, 2005
  3. Miss Michelle. Heigardt
    Replies:
    8
    Views:
    143,944
    abbinv
    Apr 9, 2011
  4. cyberco
    Replies:
    4
    Views:
    3,869
    Roedy Green
    Feb 14, 2006
  5. powah
    Replies:
    5
    Views:
    2,198
    Arne Vajhøj
    Mar 22, 2009
Loading...

Share This Page