![]() -cp classes tells it to look in the classes directory for the.java files in src/myjavaħ) run it via java -cp classes myjava.Main src/myjava/*.java tells it to compile all of the.-cp tells the compiler where to look for classfiles.-d tells the compiler where to put the.DO NOT add the src\myjava directory or it won't work in NetBeans.ĥ) make a directory called classes\ (so you you have src\, classes\, and maybe \tests all in the same place)Ħ) on the command line type javac -d classes -cp classes src/myjava/*.java When you are setting up the src (and optional test) directories add the src\ (and optionally the tests\) directory. ![]() I would also like to emphasize that I'm just a beginner in Java programming.ġ) create a directory with src\ and tests\ in it (the tests is optional if you are not using JUnit).Ģ) assuming you have package myjava at the top of your files (and make sure that this is what your prof wants, it becomes a pain to mark things if they are not in the right place), make a src\myjava directory (and if you are doing JUnit a tests\myjava directory).ģ) copy your files into the src\myjava directoryĤ) delete your NetBeans project and recreate it as a new on with exising sources. I just wanted to put in as many details as possible.) Share Improve this answer edited at 4:46 Gaff 18. Here's an example command line: hstart /UAC 'notepad.exe' This will pop up the UAC dialog rather than ask for a password like runas does. What should I do? (Sorry for my kilometric-long explanation. 9 Answers Sorted by: 13 It looks like this utility - Hidden Start - will do what you wish if you use the /uac switch. Method)Īt (URLCla.Īt (ClassLoa.Īt &AppClassLoader.loadCla.Īt (ClassLoad.Īt (. Here's how I tried to run the files in cmd: java Main Sortchoice Selection SelectionSort Insertion InsertionSort Exchange ExchangeSortĪnd cmd says: exception in thread "main" : main (wring name: myjava/Main)Īt 1(Nativ. (I havent finished the syntax for the next two sorting.) Here's how I tried to compile the files: javac Main.java The problem sets in when I tried to run them. 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. but it says that "'javac' is not recognized as an internal or external command, operable program or batch file." In cmd, I typed the path where my NetBeans project was saved and I tried to compile the files using javac. I tried to write the program in NetBeans - thinking that later I could simply run the program in cmd using javac. 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. The program is about using the different types of sorting (specifically Selection, Insertion, Exchange, Quick, and Heap sorting). 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. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |