Results 1 to 3 of 3

Thread: html and java

  1. #1
    dnbhead is offline Member
    Join Date
    Dec 2011
    Rep Power

    Default html and java

    i would like to put the results of my scanner onto an html using the java program itself. i have tried using a command exec but i failed ot get it to work. any suggestions/pointers in the right direction would be excellent. heres my code so far.
    Java Code:
    import java.util.Scanner;
    public class Generator {  
        private File file;  
        public static void main(String args[]) throws FileNotFoundException {  
            Generator String = new Generator("results.txt");   		//line to input the text file
            String.processLineByLine();   					//line by line reading from the text
        public Generator(String txt) {  
            file = new File(txt);   						//open a new text file for scan after
        public void processLineByLine() throws FileNotFoundException {  
            Scanner scan1 = new Scanner(file);   				
            try {  //
            												//Scanner to get each line  
              while ( scan1.hasNextLine() ){  				//continue to the next line
                processLine( scan1.nextLine() );  
            finally {  
              scan1.close();  								//no next line = scanner close
        public void processLine(String aLine){  
                											//use a second Scanner to string the content of each line   
                Scanner scanner = new Scanner(aLine);  
                while ( scanner.hasNext() ){  
                  String event =;   // name the columns
                  String co1 =;
                  String co2 =;
                  String co3 =; 
                  String competitor1 =; 
                  String competitor2 =; 
                  String competitor3 =;
                  System.out.println( event + ":  (Gold) " + competitor1 + co1 + ",  (Sliver) " + competitor2 + co2 + ", (Bronze) " + competitor3 + co3);  
                }  											//print out the result 
                scanner.close();  							// close the scanner
    Last edited by Norm; 12-13-2011 at 03:52 PM. Reason: added code tags

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: html and java

    put the results of my scanner onto an html
    Please explain what "onto an html" means?
    Do you want the program to write out an html file and then have a browser read that file and display it?

  3. #3
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Re: html and java

    well depends if you want it to update online instatly or just have it create and load a file? I'm assuming by the code that your just trying to get it to load a file, one start would be to save the file as a html rather than a txt file, webpages tend to open as htmls, also could help if you posted what you tried :D

Similar Threads

  1. HTML/Java
    By Bomber_Will in forum New To Java
    Replies: 5
    Last Post: 03-21-2009, 09:37 PM
  2. Using HTML in java
    By hitmen in forum AWT / Swing
    Replies: 3
    Last Post: 02-26-2009, 05:58 AM
  3. Java + html
    By GabWit in forum New To Java
    Replies: 4
    Last Post: 01-25-2009, 03:58 AM
  4. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  5. Java Applet HTML
    By ownlol in forum Java Applets
    Replies: 4
    Last Post: 07-21-2008, 02:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts