Any idea how I can print my source code in an internet browser?
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.
Any idea how I can print my source code in an internet 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.
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?
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.