Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: print code to browser

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default print code to browser

    Any idea how I can print my source code in an internet browser?


  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: print code to browser

    Quote Originally Posted by bookface View Post
    Any idea how I can print my source code in an internet browser?
    I think u can use java docs to print our source code in browser

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: print code to browser

    Hello bookface. Nice name by the way haha

    Can you please elaborate slightly? Why do you wish to display the source code in a web browser?

    Thanks.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  4. #4
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: print code to browser

    Haha thanks!

    In brief, my program reads a soure code saved in txt file, formats it accordingly (ie highlights string in green, keywords in orange, comments in grey and makes the appropriate indentation) then displays the latter in a browser.

    Now that I think about it. Can I just write the source code to a file and save it as -.html through coding so that the user can open it and it'll automatically open in the browser?

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: print code to browser

    If you are using servlet container then there are many many web UI libraries out there using which you can efficiently generate your formatted html code and publish on to the server.

    If you wish to generate a standalone html file then use any standalone HTML UI library(very few of them are available) to format the code into HTML and flush it to output file.

Similar Threads

  1. How to print results to screen
    By NinjaLink in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 19th, 2010, 01:46 PM
  2. [SOLVED] why does this code print 0.0 for the value and "F" as the letter grade?
    By etidd in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 12th, 2010, 10:38 PM
  3. Can someone please tell me why my code doesn't print out anything?
    By deeerek in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 6th, 2010, 08:35 AM
  4. Need java code to know the browser status
    By newnewgen in forum Java Theory & Questions
    Replies: 2
    Last Post: January 8th, 2010, 11:39 PM
  5. print hex decimal value
    By ran830421 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 25th, 2009, 07:23 PM