This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
Thanks Tim and Henry. I tried using the Runtime and ProcessBuilder option. Here is the code i created:
This program executes without any errors or exceptions but the HelloWorld program does not execute. In my HelloWorld program I am writing to a "out.txt" file, but after executing this program when I open the "out.txt" file it is blank.
The HelloWorld program executes fine through the command prompt. But in the command prompt we use the following command set path = "C:\Program File\Java\jdk\bin" . Do I have to do use this command in this case too? If so, how?
We don't do java file_system_path_to_class_file. We do java -cp some_classpath fully.qualified.ClassName
So, if your HelloWorld class is not in a package, and you have C:/HelloWorld.class, then you'd execute java -cp C:/ HelloWorld
If, on the other hand, HelloWorld was in package com.mycompany.hello, and you had, for example, C:/projects/HW/com/mycompany/hello/HelloWorld.class, then you'd execute java -cp C:/projects/HW com.mycompay.hello.HelloWorld
Note that the class must be in a subdirectory path matching the package name, and the parent directory of the root of that subdirectory must be on the classpath.