aspose file tools*
The moose likes Cattle Drive and the fly likes OOP1 Classpath issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "OOP1 Classpath issue" Watch "OOP1 Classpath issue" New topic
Author

OOP1 Classpath issue

Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
I have put the jr.jar file in my Java Training\CattleDrive\ folder. In my class path I have:

At the top of my DaysOld.java file I have

When I go and try to compile I get this error:

I have looked and tried pretty much everything on the board. I keep seeing where people talk about a .zip file, but I have a jar. I don't know where to go from here.
[ April 04, 2007: Message edited by: Tony VanHorn ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
[I]Originally posted by Tony VanHorn:
I have put the jr.jar file in my Java Training\CattleDrive\ folder. In my class path I have:
[/I]

I generally try to avoid spaces in my paths. They can cause lots of problems. I also notice that the path to jr.jar is the only one in your path surrounded by quote marks. To resolve both of these issues at one time, my classpath would look more like this:
<pre>(pre-existing stuff);C:\JavaTraining\CattleDrive\jr.jar</pre>
or
<pre>(pre-existing stuff);C:\Java_Training\CattleDrive\jr.jar</pre>
or
<pre>(pre-existing stuff);C:\Java\Training\CattleDrive\jr.jar</pre>

It's too short to shorten like
<pre>C:\Progra~1\Common~1\Adobe\AGL</pre>

Have you tried it without the quote marks? I would think that if the "Program Files\Common Files" stuff works without quote marks, that the path to jr.jar should work without quote marks.

(By the way, I think it is unnecessary and probably unwise to include C:\Program Files\Java\jdk1.6.0\bin in your classpath.)
[ April 05, 2007: Message edited by: Marilyn de Queiroz ]

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Originally posted by Tony VanHorn:
I have looked and tried pretty much everything on the board. I keep seeing where people talk about a .zip file, but I have a jar. I don't know where to go from here.

jr.jar, jr.zip, JavaRanchCommon.zip, JavaRanchCommon.jar -- different names for different versions of the jar.
Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
Originally posted by Marilyn de Queiroz:
my path would look more like this:
<pre>(pre-existing stuff);C:\JavaTraining\CattleDrive\jr.jar</pre>

Have you tried it without the quote marks? I would think that if the "Program Files\Common Files" stuff works without quote marks, that the path to jr.jar should work without quote marks.

I had tried it without the quotes, but saw somewhere on the boards that if you have a space you need to include quotes around it. As for taking the spaces out, I did that but it still continues to give the same error at compile time.
Originally posted by Marilyn de Queiroz:
(By the way, I think it is unnecessary and probably unwise to include C:\Program Files\Java\jdk1.6.0\bin in your classpath.)[/QB]

Could you explain why. In the Just Java 2 book it shows on page 782 to add the information to the class path so that you don't have to type it in every time you want to compile or run it. Am I missing something or did I misunderstand?

(edit)Okay, I am sufficiently confused. Is there a difference between PATH and CLASSPATH? There probably is, but at this point I am lost.
[ April 05, 2007: Message edited by: Tony VanHorn ]
Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
Okay, so there is a difference. I had to actually add the CLASSPATH variable because all I had was the Path. Anyway, with that change, everything compiles fine. It may not run fine, but compiling is a great start. Sorry for my misstatement about that being my class path in my first post, that is probally why you said it was unnecessary and not a good idea. I think I am on the same page with you now.

Tony
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Originally posted by Tony VanHorn:
Okay, I am sufficiently confused. Is there a difference between PATH and CLASSPATH? There probably is, but at this point I am lost.

Your PATH environment variable includes various paths to executables (like java.exe and javac.exe) while your CLASSPATH includes various paths to classes and jars that your application needs outside of those that are always included (like java.lang.String) by the jdk itself.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Originally posted by Tony VanHorn:
I had tried it without the quotes, but saw somewhere on the boards that if you have a space you need to include quotes around it.

It depends ... which is why it's best to just avoid spaces anytime you can.
Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
Oh man, I feel like such a maroon. I was looking at the first page of the cattle drive and "TADA!" it explains the whole PATH and CLASSPATH stuff. I guess you'll have that. I promise I will pay 'better' attention. I am sure I will do something like this again, as I always try to do things faster then my brain can keep up. Thanks for the answers Marilyn and putting up with my questions.
 
jQuery in Action, 2nd edition
 
subject: OOP1 Classpath issue