Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

OOP1 Classpath issue

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[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 ]
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic