compiling packages

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
tc

compiling packages

Post 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?
Jim Garacci

Re: compiling packages

Post 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...
Ned

Re: compiling packages

Post 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
ned

Re: compiling packages

Post 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!
Post Reply