Shaya Potter writes:
 > 
 > Maybe I'm not so quick about this, but I can't seem to figure out how one
 > gets JDE to compile a program that's in a package, correctly w/o forcing a
 > -classpath in the compile time options?
 > 
 > why is this?
 > 
 > I am trying to edit
 > 
 > proj3.controller.MyController.java
 > 
 > so I call emacs proj3/controller/MyController.java
 > 
 > the file has the package line appropriatly.
 > 
 > However, when I tell JDE to compile it, it insists on cd'ing into
 > proj3/controller! and javac of course doesn't like that.
 > 

The cd line at the top of the compilation buffer is simply an Emacs
convention used to indicate the current directory when the compiliation
command is invoked. No cd command is ever issued.

The JDE always compiles with a Java source buffer
selected. The current directory of an Emacs buffer is always the
directory of the file associated with that buffer, if any. Therefore
the current directory of a Java source buffer is always the directory
of the Java source file as indicated by the pseudo cd line at the
top of the compilation buffer. 

 > Is their any way to automate JDE's ability to know about packages so I
 > don't have to change the classpath for each project?
 > 

I suppose there could be a version of the compile command that 
parses the source file for the presence of a package statement
and then cd's to the directory containing the package before
compiling. I'm not much motivated to do this myself as most of the
projects I work need more than what is in the current package
and in the JDK packages. Further, it is very easy to set up
project files for each project and let the JDE switch classpaths
for me as I move from project to project. However, if someone
else wants to write a compile-from-package-root command, I'd
be happy to include it.

- Paul

Reply via email to