I currently have this code:
import java.util.Random;
import java.io.*;
public class randomdwarf {
public static void main(String[]args)throws IOException {
String dwarves[]=
{"Dopey", "Sneezy", "Happy", "Sleepy", "Grumpy", "Bashful", "Doc"};
Random generator = new Random();
int randomIndex = generator.nextInt( 7 );
System.out.println(dwarves[randomIndex]);
Runtime.getRuntime().exec("H:\\Profile\\Desktop\\dwarves\\Doc.jpeg");
}
}
It is a very simple code that is designed to get a random dwarf name then display the image. Note that currently I am just testing the program out and have it only open the picture of "Doc". I will implement the random image opening once I figure out how to open the image. After searching for a while I have not been able to find a solution. I am currently using windows and would appreciate any help you can give me.
Thanks,
Jaro