While using jGRASP I noticed that the output for programs in packages was slightly different than normal, specifically the program names appeared to be relative paths starting from the top of the class.
For example, for a Java program that includes the statement package ch01.stacks;
, the compile output looks like:
javac -g ch01\stacks\ArrayStack.java
and the run output appearing similarly.
I was wondering if there was a relatively straightforward way to simulate this behavior in other programs such as Notepad++ or gedit where users can set up scripts to compile programs.
EDIT: I apologize, I forgot to mention that the compilation scripts I'm talking about are essentially the program filename passed to javac. I would rather not use absolute paths, I would like my scripts to work in a way similar to jGRASP if at all possible.
To further clarify the issue at hand, with my current scripts I believe the package structure is giving me issues, since it is compiling in the current directory of the program. I am looking for a way to relatively compile my Java programs with respect to package structure.
That is, is there any way to detect the top directory needed for the compile (ch01 in the previous example) without having to dig through the program looking for package
?