KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My professor asked us to create a Java program that would be able to run in command prompt but could also be opened using NetBeans. The program is about using the different types of sorting (specifically Selection, Insertion, Exchange, Quick, and Heap sorting). our professor specifically told us to use object oriented programming in Java, and that she wants to see a main class plus the different classes that would do the sorting. I tried to write the program in NetBeans — thinking that later I could simply run the program in cmd using javac. In cmd, I typed the path where my NetBeans project was saved and I tried to compile the files using javac. but it says that "'javac' is not recognized as an internal or external command, operable program or batch file." So I tried to save the files in sun>sdk>jdk>bin, and from there I tried to compile the files, and it was fine. The problem sets in when I tried to run them. Here's how I tried to compile the files: javac Main.java Sortchoice.java Selection.java SelectionSort.java Insertion.java InsertionSort.java Exchange.java ExchangeSort.java (I havent finished the syntax for the next two sorting.) Here's how I tried to run the files in cmd: java Main Sortchoice Selection SelectionSort Insertion InsertionSort Exchange ExchangeSort and cmd says: exception in thread "main" java.lang.NoClassDefFoundError: main (wring name: myjava/Main) at java.lang.ClassLoader.defineClass1(Nativ... Method)" at java.lang.ClassLoader.defineClass(ClassL... at java.security.SecureClassLoader.defineCl... at java.net.URLClassLoader.defineClass(URLC... at java.net.URLClassLoader.access$000(URLCl... at java.net.URLClassLoader$1.run(URLClassLo... at java.security.AccessController.doPrivile... Method) at java.net.URLClassLoader.findClass(URLCla... at java.lang.ClassLoader.loadClass(C
Tags (comma-separated)
Save Edits
Cancel