error importing with javac

I am trying to compile code which was last compiled under JDK 1.2 (!). The code consistst of 2 packages - one is dependent upon the other.

The low-level package (aka Utils) builds without error. However, the other lib generates an error when it reaches an import statement of the 1st package. See below:

C:\GUITools>javac -cp .;C:\Utils *.java

CalendarTable.java:8: package Utils does not exist

import Utils.*;

For kicks, I placed the Utils.jar file into the GUITools directory. The Utils package was still not found.

I have set CLASSPATH is include both directiores in question. This code used to complie and run. So the question is: is my environment configured incorrectly? Or are there new requirements imposed by ver 1.5 of javac.exe?

[785 byte] By [Bassmana] at [2007-10-3 10:28:18]
# 1
If all of the Utils classes are in the jar, you need to include the jar file, not its directory. Something likejavac -cp .;C:\Utils\Utils.jar *.java
atmguya at 2007-7-15 5:50:44 > top of Java-index,Developer Tools,Java Compiler...
# 2

Yes, that's what I thought. I tried including the .jar file in the path and received the same errors. Which leads me to believe:

1) the Utils.jar file is bogus

2) the -cp switch is being ignored

3) the C:\Utils directory is not being found or resolved

4) the differences between JDK 1.2 (when it compiled) and 1.5 (it doesn't compile) require source code changes I am unaware of. Is that possible?

Bassmana at 2007-7-15 5:50:44 > top of Java-index,Developer Tools,Java Compiler...
# 3

> 1) the Utils.jar file is bogus

possible

> 2) the -cp switch is being ignored

not really

> 3) the C:\Utils directory is not being found or

> resolved

Are the classes in the Utils package located in c:\Utils\Utils\*.class? Or should that be C:\Utils\*.class? in which case the classpath element should be C:\ not C:\Utils. And maybe C:\Utils\Utils.jar doesn't work because it has the same error? it should contain Utils\*.class, not just *.class.

> 4) the differences between JDK 1.2 (when it compiled)

> and 1.5 (it doesn't compile) require source code

> changes I am unaware of. Is that possible?

not really.

ejpa at 2007-7-15 5:50:44 > top of Java-index,Developer Tools,Java Compiler...
# 4

If I understand correctly, you created the Utils.jar. So it is possible that the classes are not jar'ed correctly. You can see what's inside the jar file using "jar tf Utils.jar" assuming Utils.jar is in the current directory. This should show your .class files inside a Utils directory. The source code for the files should start with "package Utils;" and when you jar them, you need to preserve the directory structure, something like "jar cf Utils.jar Utils\*.class"

Or better yet, try to get you code working without jar'ing anything. Then jar it up later.

There is nothing you have posted that indicates a problem with JDK 1.2 versus 1.5.

atmguya at 2007-7-15 5:50:44 > top of Java-index,Developer Tools,Java Compiler...