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

G

Gabe

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
 
C

Cid

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)
 
G

Gabe

Cid said:
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.
 
C

Cid

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top