Compiling / running Java from one folder up -



Compiling / running Java from one folder up -

i have next directory structure:

folder1/ folder2/ compiler.java

for school assignment, have able run next commands from folder1:

javac folder2/compiler.java java folder2/compiler

the compilation javac works. when seek run above java command,

exception in thread "main" java.lang.noclassdeffounderror: folder2/compiler (wrong name: compiler)

you have 2 options.

if class compiler in default bundle this. (no bundle declaration)

javac folder2/compiler.java java -cp folder2/ compiler

otherwise, if class compiler in bundle folder2 this.

javac folder2/compiler.java java -cp . folder2.compiler

you can set complier in folder2 bundle putting bundle declaration @ top of compiler.java

package folder2;

java

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -