console application - java command will not execute my .class file -



console application - java command will not execute my .class file -

i have 2 .class files in same directory.

one class file containing class wrote not have main function. other class file contains public static void main function creates object of class , calls 1 function.

when compile , run these within netbeans ide, runs fine. if navigate .class files through windows command prompt , seek run files using java command, error saying cain't find main class.

here's class main function:

package a3; public class maintest { public static void main(string[] args) { a3 test = new a3(); test.quiz(); } }

and class of methods defined so:

package a3; import java.util.scanner; import java.util.random; public class a3 { public void quiz() { // stuff } //more helper functions called quiz function } // end of class

when seek run command prompt using: java maintest

i get: error: not find or load main class maintest though i'm staring @ maintest.class file in directory i'm using command... missing here?

also should not i'm able launch other java applications same command, don't think has environment variable. must code.

you need run directory outside of a3 directory (the 1 has class files), execute this:

java a3.maintest

java console-application command-prompt

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -