aspose file tools*
The moose likes Cattle Drive and the fly likes Stuck on the classpath again! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Stuck on the classpath again!" Watch "Stuck on the classpath again!" New topic
Author

Stuck on the classpath again!

Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
I'm trying to get the BeeServlet that should be displayed using MCV2, but it ain't working. I get the original, a-buzz-buzz. Hmmmmm.
Looking for the ActionServlet class in my version of com.javaranch.common, I find it is not there. I downloaded the jr.jar and stuck it all the places I was told to stick it, and also put C:\java\jr.jar; right after C:\java; in my classpath, (a subject that still terifies me.)
I don't get the difference between jr.jar and com.javaranch.common. They seem to be referred to as similar entities, but with different names. Is jr.jar and com.javaranch.common the same thing or not? I are confused.....
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
jr.jar is the new, improved version of JavaRanchCommon.jar (also known as JavaRanchCommon.zip). They both contain the package com.javaranch.common and all its classes. Don't keep JavaRanchCommon.jar or JavaRanchCommon.zip in your classpath. Substitute jr.jar everywhere you were using the other jar (like in the logApp, for example). Also, if you've unpackaged the classes (unzipped them), you'll need to delete all those classes (in the com\javaranch\common subdirectory). Otherwise your computer may be very confused trying to figure out which classes to use (or you may be very confused trying to figure out which classes your computer is using).
[ August 19, 2005: 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
Kristin Stromberg
Ranch Hand

Joined: May 17, 2005
Posts: 91
Is it just me, or is the subject stuck on the classpath again meant to be sung to the tune of back in the saddle again?

At any rate, welcome back Carol!
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187

Don't keep JavaRanchCommon.jar or JavaRanchCommon.zip in your classpath.
Removed that from my classpath.(!)
Substitute jr.jar everywhere you were using the other jar (like in the logApp, for example).
Do you mean to change any reference to JavaRanchCommon.jar to jr.jar? I hope it doesn't appear in too many places!
Also, if you've unpackaged the classes (unzipped them), you'll need to delete all those classes (in the com\javaranch\common subdirectory).
I placed a copy of jr.jar in orion\lib\ as instructed, but BeeServlet didn't work, so I also uzipped the file to that directory. Should I delete the directory named com that holds the rest of the directories, or the class files that are contained in those directories? Should I also replace the com folder where it appears in my java directory, where I do all of my coding/compiling with jr.jar? I have jr.jar unzipped there as well as in the classes directory in orion. Should I replace those with the zipped copy of the file? Does orion know how to un-zip the file?
Otherwise your computer may be very confused trying to figure out which classes to use (or you may be very confused trying to figure out which classes your computer is using).
I don't know if my computer is confused, but I sure am!


Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Waaahhhhhh!!!
I changed the import statement for javaranch.common to jr.jar in one of the LogApp java files, and when I tried to compile I got an error message stating that jr.jar couldn't be understood, or something along those lines. So I changed it back, and now the LogApp doesn't function right. It isn't able to acces the student list for edit or delete!
What have I done!!!
I think I'll go have a drink.........
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Originally posted by Carol Murphy:
I changed the import statement for javaranch.common to jr.jar

Does the import statement (import com.javaranch.common.*) have .jar on the end of it? I'd be surprised if you reference anything named something.jar in any of your code.

(edit) It may be in the LogApp.bat file if you still use that.
[ August 19, 2005: Message edited by: Marilyn de Queiroz ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Doh!
So what is the name of the file I'm importing, jr or com.javaranch.common?
I feel like a total fool!
Need more beer.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
You are importing the com.javaranch.common package, and it is in the jr.jar file. So you put the path to the file in your classpath and import the package.

You do not import a file.
[ August 19, 2005: Message edited by: Marilyn de Queiroz ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
So my import statements remain the same, as the name of the package hasn't been changed, only its location?
Also, the jr.jar file itself is represented by an icon with a rather unremarkable flag on it. Is this file what I should be placing intact in all of the places where the com.javaranch.common directories were located? If that is the case, then things still aren't working as they should.
I'm wondering if my version of the J2ee SDK is too old. I tried downloading 1.4, but apparently it won't run on windows98. I'm using 1.3. Could that be a problem, or is it just the placement of jr.jar that is screwing me up?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
So my import statements remain the same, as the name of the package hasn't been changed, only its location?

True.

Also, the jr.jar file itself is represented by an icon with a rather unremarkable flag on it. Is this file what I should be placing intact in all of the places where the com.javaranch.common directories were located?

I can't say about the icon. That may mean that Win98 isn't set up to recognize what a jar file is. But it doesn't affect anything we're doing now.

For example, say you had
C:\java\com\javaranch\common\Files.class
C:\java\com\javaranch\common\Str.class
C:\java\com\javaranch\common\LogServlet.class
etc.

Now you have
C:\java\jr.jar

Leaving the LogApp alone for the moment, does BeeServlet work? If so, then we'll deal separately with the logApp.

I'm wondering if my version of the J2ee SDK is too old. I tried downloading 1.4, but apparently it won't run on windows98. I'm using 1.3. Could that be a problem

I'll have to check that out tomorrow on my other computer. But at this point I believe that the new jar works with version 1.3

(edit)I can run BeeServlet using the new jr.jar on Win95 with orion1.4.5 and java1.3.0 and j2sdkee1.2.1 -- pretty old stuff.
[ August 20, 2005: Message edited by: Marilyn de Queiroz ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
The original BeeServlet is working from Servlets1. I was able to see the a-buzz-buzz message using both the servlet and jsp method. My problem is with the MVC2 exercise at the end of Servlets2. I got the a-buzz-buzz message when I should have been getting the MCV2-buzz-buzz message. I deleted the servlet class file in the the classes directory of orion, and now I can't see either message. So something is wrong with my set-up for viewing the jsp using the MVC2 code.
I just assumed it had something to do with classpath, because classpath haunts my dreams. Seriously. It's becoming a phobia.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Did you remember to change the C:\orion\lib\JavaRanchCommon.jar to C:\orion\lib\jr.jar?
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Should I create a directory named jr.jar in which to place the jr.ja file? I have a copy of the jr.jar file in orion\lib, but I just noticed the JavaRanchCommon.jar files were unzipped in a directory with that name. When I look at the properties for jr.jar, the path looks like orion\lib. So I created a directory called jr.jar, now the path looks like orion\lib\jr.jar. Now I will try to run the BeeServlet and see what happens.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
You should not have any subdirectories in orion\lib, only jar files.
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Okay, BeeServlet is not working. The jsp files, moo.html, and DateServlet all work, but BeeServlet doesn't. DateServlet and BeeServlet class files are both in the classes directory of orion. I am very puzzled.
If DateServlet works, why won't BeeServlet? What gives?
This is how my path and classpath look at the moment. See anything out of place?

PATH=C:\j2Sdk1.4.2_09\bin;C:\J2SDK1.4.2_09\JRE\BIN;C:\java\bin

@SET CLASSPATH=C:\PROGRA~1\PHOTOD~1.1\ADOBEC~1;.;C:\j2sdk1.4.2_09\lib;C:\java;
C:\java\jr.jar;C:\j2sdkee1.3.1\lib\j2ee.jar;C:\mysql-connector-java-3.0.11-stable\mysql-connector-java-3.0.11-stable-bin.jar;
C:\XT\xt.jar;C:\XML\SAX;C:\XML\xp\xp.jar;
c:\PROGRA~1\COMMON~1\NETWOR~1\VIRUSS~1\40~1.XX\scan.exe c:\

As for the LogApp, it looks like the log files have been rendered useless, and I must re-enter all of the students on the cattle drive from scratch. I must have done something really bad in my former life.................

[ August 21, 2005: Message edited by: Carol Murphy ]
[ August 21, 2005: Message edited by: Marilyn de Queiroz ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Originally posted by Kristin Stromberg:
Is it just me, or is the subject stuck on the classpath again meant to be sung to the tune of back in the saddle again?

At any rate, welcome back Carol!


Kristin, I'm working on a version of this song for the next JavaRanch Journal! I might need some help with a few of the lyrics!
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
This is just plain wierd. NowServlet works. SnoopServlet works. DateServlet works. BeeServlet, in any of its incarnations, doesn't work. I tried deleting all files named BeeServlet from my C drive by going to find files. I found 11 files named BeeServlet. I deleted them all. I went back and followed the instructions for Servlets starting from download orion. ( I didn't actually download orion again. ) Everything seems to work except the file named BeeServlet. I give up for now. This is so frustrating.
Kristin Stromberg
Ranch Hand

Joined: May 17, 2005
Posts: 91
Hi Carol - I'd be happy to help with the lyrics, particularly if you like silly.

As for your BeeServlet woes, I don't think it's a classpath issue; otherwise you wouldn't be able to run all those other servlets. Maybe the old version of the JSP has been cached on your machine and the cached version is being loaded instead of the MVC2 version? I just did a quick test and found a file called C:\orion\application-deployments\default\bee\persistence\bee.jsp.jspcache. I have a feeling that if you do a search for *.jspcache on your machine and delete anything that looks bee related, you might be in luck. Of course, just to be safe, you'll want to restart Orion as well.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
You got rid of all the subdirectories that were in C:\orion\lib, right? So all you have in there is hsql.jar (or hsqldb.jar), jr.jar and maybe a left-over mysql-xxx.jar. And no JavaRanchCommon.jar or JavaRanchCommon.zip anywhere in orion's subdirectories.

You definitely need to stop orion and maybe even close all your browser windows. Then you recompile BeeServlet (the first one, not the one that uses ActionServlet) and copy the BeeServlet.class file to the orion classes directory. Restart orion and restart the browser. Now what do you see?
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
In orion\lib I have five jar files. These are hsql, hsqldb, jr, and 2 different mysql-connector files. There are also directories, which I did not place there. These are named Meta-info, src and test. Inside src there is a com directory that holds javaranch.common files. Should I delete that directory? Test also holds a directory named unit that has a copy of the com.javaranch.common,but common only contains two java files named TestNumbers and TestStr, not the class files you would expect. Should this be deleted? The test directory also holds two other directories named function and non-regresion.
Looking through orion I am finding com.javaranch.common folders stashed everywhere. There is the one placed in orion\default-web-app\WEB-INF\classes, and there is a duplication of the Meta-info, src, and test directories found in orion\lib.
I don't know how all of these copies of com.javaranch.common got in all of these different places, but I'm wondering if the wisest thing to do would be to remove orion completely and start from scratch with the new jr.jar file. Yhe only place I should put a copy is in orion\lib, right?
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1187
Okay, we have a-buzz-buzz! (And I haven't even had a drink!)
I deleted the orion directory from C:\ and unzipped it afresh.
Following the instuctions to a T, I now have a working BeeServlet.
I also spent the afternoon re-inputting all 156 students in the Cattle Drive application, so now everything should be back to normal, or what passes for normal.
What I can't figure out is how eveything got so screwed up in the first place!!!
What a nightmare!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
In orion\lib I have five jar files. These are hsql, hsqldb, jr, and 2 different mysql-connector files. There are also directories, which I did not place there. These are named Meta-info, src and test. Inside src there is a com directory that holds javaranch.common files. Should I delete that directory?

Yes. Although source files won't hurt anything, they don't belong there.

Test also holds a directory named unit that has a copy of the com.javaranch.common,but common only contains two java files named TestNumbers and TestStr, not the class files you would expect. Should this be deleted?

Yes. Same reason.

Looking through orion I am finding com.javaranch.common folders stashed everywhere .... I'm wondering if the wisest thing to do would be to remove orion completely and start from scratch with the new jr.jar file.

That would probably be the easiest and simplist way to clean up.

Yhe only place I should put a copy is in orion\lib, right?

Right.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stuck on the classpath again!
 
Similar Threads
OOP1 Classpath issue
Ready to drink a jar
HttpServlet not found on Laptop, but found on Desktop
JDate not found in JDateTest
compiler not finding com.javaranch.common