• Post Reply Bookmark Topic Watch Topic
  • New Topic

classpath question (directory below current)  RSS feed

 
Tommy Griffith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I have a deployed WAR but I need to make one change in one class (SQLLookup). Here is the package/directory structure.


package com.company.queryengine;

import com.company.queryengne.config.*;



SQLLookup.java is located in com/company/queryengine folder.

the classes it needs to instantiate and import are both in the same directory (package) and in the com/company/queryengine/config folder (one below)




I haven't set any system classpath as this is one file in a specific WAR and I've never done command line -cp for a directory below the current one, am I approaching this right?

This is the one attempt from the command line in the directory where SQLLookup resides which I can't figure out why it doesn't work...


javac -cp .;ojdbc14.jar;config/* SQLLookup.java



the period means it looks in the current directory (package) for classes it needs...

ojdbc14.jar is listed explicitly as it's not part of the package...

config/* tells it to look in the subordinate config directory for other classes it needs.



I don't think I need to explicity list each class in these directories, right? Thank you so much for reading.
 
Tommy Griffith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh, one thing I noticed, this is a single class within a servlet I need to edit. I am thinking I could just try to recompile this class as I'm trying and redeploy as a war and it shouldn't be a problem, as the servlet context itself doesn't change. It's just a few lines in one of the classes. Is this right?

Thank you again.

 
Tommy Griffith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. This is really driving my up a wall. I've tried everything. I keep getting package does not exist and "cannot find symbol" on the object classes I am trying to instantiate in SQLLookup.java.


I tried to explicitly enter each directory in the -cp...two where the classes exist in the war and the third to the external ojdbc.jar (easier than typing the WARs lib path)


javac -cp c:\base\com\company\queryengine;c:\base\com\company\queryengine\config;c:wf\ojdbc14.jar SQLLookup.java


I tried quotes...

javac -cp "c:\base\com\company\queryengine";"c:\base\com\company\queryengine\config";"c:wf\ojdbc14.jar" SQLLookup.java


all sorts of variations. if anybody has an idea, I'd really appreciate it. thank you.


Oh, I am running...

javac -cp c:\base\com\company\queryengine;c:\base\com\company\queryengine\config;c:wf\ojdbc14.jar SQLLookup.java


from the same directory where SQLLookup.java exists (c:\base\com\company\queryengine). Is that ok?
 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-cp c:\base\com\company\queryengine

Your classpath entries should reference to root of your class directory, not the individual packages.

Your package is defined as:
package com.company.queryengine;

SO your classpath should refer to base and not all the way down to queryengine (and beyond).
 
Tommy Griffith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Dave. Yeah, I was compiling in the wrong directory, I was down in the same directory as the Java file. I had to move back up to above "com" then type javac -cp .;c:\wf\ojdbc14.jar com/company/QueryEngine/SQLLookup.java then it sees all classes and the subdirectory(s).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!