Changing output from console to .html
hi ive got a project that i need to output to a .html file and i also need to make sure that i include HTML elements such as <td></td> i'm new to java and need a starting point for this.
Removed code due to other students googling it and copying my code.
Re: Changing output from console to .html
right i've managed to edit the program so it outputs to the console and to a .html file when i run it. but my assignment says i need it only needs to output to html when a command such as:
java Generator –html results0809.txt
is run... but i don't really understand this as i just run the program in eclipse?
thanks
Re: Changing output from console to .html
In Eclipse, go to Run->Run Configurations... and click on the arguments tab. From there you can enter command line arguments, such as "–html results0809.txt". These are then passed to your args parameter in the main method, where they should be dealt with accordingly.
Re: Changing output from console to .html
thanks for the reply i understand it better now but i still don't see what i'm asking my program to run if you understand what i mean... what is the actual -html supposed to do? is it a class im asking the program to run or what?
Re: Changing output from console to .html
Quote:
Originally Posted by
RSYR
what is the actual -html supposed to do?
This is up to the program. Placing text after the class name (or jar name) when running from the command line is a way of passing data to your program. Your program can intercept these in the main function. For example:
java Generator –html results0809.txt
In the main method what happens is
Code :
public static void main( String args[] ){
///args[0] is "-html"
///args[1] is "results0809.txt"
}
So in your case you can determine whether to output to html, and what file to do so, by checking the args parameter.
Re: Changing output from console to .html
thanks for the reply again i'll read up on it :)
Re: Changing output from console to .html
Quote:
Originally Posted by
copeg
This is up to the program. Placing text after the class name (or jar name) when running from the command line is a way of passing data to your program. Your program can intercept these in the main function. For example:
java Generator –html results0809.txt
In the main method what happens is
Code :
public static void main( String args[] ){
///args[0] is "-html"
///args[1] is "results0809.txt"
}
So in your case you can determine whether to output to html, and what file to do so, by checking the args parameter.
hi again, i'm not really getting it would you mind if i posted my attempt so you could tell me where i'm going wrong? sorry to be a bother thanks