Page 1 of 1

compiling packages

Posted: Wed Mar 20, 2002 4:50 pm
by tc
In the lab at school I can use textpad to compile the file in a main directory, and doing so will compile all the code packages that are imported (very cool). At home I cannot get this to work. I need to take care of this from a command prompt (which then raises the issue of not being able to view enough of the Command Results). What's the deal with compiling packages?

Re: compiling packages

Posted: Tue Apr 02, 2002 3:41 pm
by Jim Garacci
This may have to do with having a -sourcepath identified.

That is, at the command line for javac, if you include a -sourcepath directive with the base path of the packages, the compiler will include the packages in the compilation.

e.g. if you have the following class in the main directory (the one that you specify with the -sourcepath directive)

import suba.A;

public class MainA {
private A a = new A();
}

--

then the compiler will find and compile the class in the sub-directory (package) "suba":

package subA;

public class A {
}

Hope this helps...

Re: compiling packages

Posted: Wed Apr 24, 2002 4:41 pm
by Ned
I have to compile from the parent directory also and this is the configuration within preferences that I find works.

for compiling
command javac.exe
parameter -classpath c:\jdk1.3\bin$File
initial folder $FileDir

for executing
command java.exe
parameter console.$BaseName
initial folder c:\java\vad

obviously "console" is the name of the package containing the file to be executed and my working directory is "C:\Java\Vad

Re: compiling packages

Posted: Wed Apr 24, 2002 4:57 pm
by ned
actually it would be great if someone could let me know if there are commands that can be used to ensure that the actually name of the parent folder does not have to be used, for example using a . as in cd.. to indicate that the command is to be run from a parent directory!