Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > while using javac -classpath some.jar some.java (Where does classpath get stored?)

Reply
Thread Tools

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

 
 
Gabe
Guest
Posts: n/a
 
      08-27-2004
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/tutor...s/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
 
Reply With Quote
 
 
 
 
Cid
Guest
Posts: n/a
 
      08-27-2004
On 26 Aug 2004 20:24:35 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (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/tutor...s/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)
 
Reply With Quote
 
 
 
 
Gabe
Guest
Posts: n/a
 
      08-27-2004
Cid <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 26 Aug 2004 20:24:35 -0700, (E-Mail Removed) (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/tutor...s/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.
 
Reply With Quote
 
Cid
Guest
Posts: n/a
 
      08-27-2004
On 27 Aug 2004 05:01:40 -0700, (E-Mail Removed) (Gabe)
wrote:

>Cid <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
>> On 26 Aug 2004 20:24:35 -0700, (E-Mail Removed) (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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK Miss Michelle. Heigardt Java 8 04-09-2011 07:20 PM
Error : Invalid path for javac.exe -classpath stuff Java 1 05-17-2006 10:06 PM
Error : Invalid path for javac.exe -classpath stuff Java 0 05-17-2006 05:27 PM
"com.sun.tools.javac.Main is not on the classpath" problem still there. drunken_wizard Java 1 03-23-2006 01:33 AM
Ant javac : How to print classpath? Ronald Fischer Java 1 09-19-2003 01:13 AM



Advertisments