Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
APPLICATION SAMPLE SITE: http://docs.oracle.com/javase/tutorial/getStarted/cupojava/n etbeans.html Steps include: 1. Lauch IDE 2. Start new project 3. In new project wizard in project categories a. select JAVA, b. then Java Application 4. Click next 5. In name and location page of wizard a. In name field, type Hello World App b. In create main class field, type helloworldapp.HelloWorldApp c. Leave the set as main project checkbox selected 6. Click finish 7. The components seen in the IDE window was as shown below Next I followed the following sets of instructions given at this site (pls note, the select platform part was skipped as my default platform is jdk 7): Add Code to the Generated Source File When you created this project, you left the Create Main Class checkbox selected in the New Project wizard. The IDE has therefore created a skeleton class for you. You can add the "Hello World!" message to the skeleton code by replacing the line: // TODO code application logic here with the line: System.out.println("Hello World!"); // Display the string. Optionally, you can replace these four lines of generated code: /** * * @author */ with these lines: /** * The HelloWorldApp class implements an application that * simply prints "Hello World!" to standard output. */ These four lines are a code comment and do not affect how the program runs. Later sections of this tutorial explain the use and format of code comments. Be Careful When You Type Note: Type all code, commands, and file names exactly as shown. Both the compiler (javac) and launcher (java) are case-sensitive, so you must capitalize consistently. HelloWorldApp is not the same as helloworldapp. Save your changes by choosing File | Save. The file should look something like the following: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package helloworldapp; /** * The HelloWorldApp class implements an application that * simply prints "Hello World!" to standard output. */ public class HelloWorldApp { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } } Compile the Source File into a .class File To compile your source file, choose Run | Build Main Project from the IDE's main menu. The Output window opens and displays output similar to what you see in the following figure: THE ABOVE WINDOW WAS SEEN WHEN THE SOURCE FILE WAS COMPILED. The generated .class file was seen in the files window as shown below: When the program was run the out put was as seen below: When it should have been as seen below: Program Out put: run: C:\Users\UDOSEN\.netbeans\7.0\var\cache\executor-snippets\run.xml:52: C:\Users\UDOSEN\Documents\NetBeansProjects\Hello World App\work is not a valid directory at org.apache.tools.ant.taskdefs.Java.setupWorkingDir(Java.java:855) at org.apache.tools.ant.taskdefs.Java.setupExecutable(Java.java:825) at org.apache.tools.ant.taskdefs.Java.fork(Java.java:788) at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214) at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135) at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) Java Result: -1 BUILD SUCCESSFUL (total time: 0 seconds) Program code: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hello.world.app; /** * The HelloWorldApp class implements an application that * simply prints "Hello World!" to standard output. */ public class HelloWorldApp { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Hello World!"); // Display the string } }