java - "Could not find or load main class" using command line -



java - "Could not find or load main class" using command line -

i trying run netbeanz project command line , works when run netbean ide

i have read this , this , sun java tutorial still unable solve problem.

my main file : hill.java located in next folder

in command line , alter directory above , run javac *.java works expected

the problem arises when effort java hill ( hill.java name of main class file )

contents of directory hill

hill.java

package hill; import java.util.random; import java.io.*; import java.util.*; import java.math.*; public class hill { public static void printmenu() { printline(); system.out.println("welcome hill cipher"); system.out.println("1) key generation"); system.out.println("2) encrypt"); system.out.println("3) decrypt"); system.out.println("4) quit"); printline(); } public static string readstring(string prompt) { system.out.print(prompt); homecoming new java.util.scanner(system.in).nextline(); } public static int readint(string prompt) { int input = 0; boolean valid = false; while (!valid) { seek { input = integer.parseint(readstring(prompt)); valid = true; } grab (numberformatexception e) { system.out.println("*** please come in integer ***"); } } homecoming input; } public static void main(string[] args) { int choice=0; { printmenu(); selection = readint("please select alternative : "); selectmenu(choice); }while (choice != 4); } }

what doing wrongly , how solve problem ??

two things.

execute "java hill.hill" src folder, not hill folder since using package. capitalize hill class reads "java hill.hill"

good luck.

java command-line compilation

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -