tags:

views:

88

answers:

2

Okay given this:

javac is the java compiler. It compiles the file, but has no output if there are no warnings or errors.

What can I use to view the file from a user's perspective- user is suppose to see a vending machine that allows them to buy certain stuff from vending machine.java, apparently just running javac somevendmachine.java is not really helping.

There are no errors from javac or feedback, so based on that assumption and the feedback from a prior question, I know the code works; however, how do I set the java code such that a user can now choose selections from the vendingmachine.java or what do I install or read?

+4  A: 

After you compiled your code you can start it using java <class name>. Your class must have a method:

public static void main( String[] args )

This method is executed when you start your program.

tangens
"java VendingMachine" also works, I was going to use an IDE but I ditched the IDE's, so I am tinkering with the command prompt, again thanks.
Newb
+2  A: 

javac only compiles the code to a class file.

You then need to run the class file through the Java virtual machine by typing

java VendingMachine
iWerner
Yeah, that's exactly what I did:java VendingMachine, worked like a charm, thanks, I was so going to ditch Java for C++, but now I will keep both and play with them, sweet.
Newb
And thanks for the clarification, I was like, where did the class file come from if I did not put it there? So javac compiles code to a class file; then, you run the class file via java someclassname.
Newb