Copy and Paste Java

Dennis Faas's picture

Infopackets Reader 'Annie' writes:

" Dear Dennis,

I'd like to know how to copy and paste something into HTML but don't know how to do it. I am trying to save an animated 'Java' clock I saw on a web site into another HTML document, but I just can't seem to get it to go. Can you please help me? I don't really know a lot about computer languages. Thanks. "

My response:

It sounds like you're trying to copy and paste Java code through the browser; regrettably, it's not as simple as this, as Java is a transparent feature of the web browser.

If you want to copy and paste Java that is present on a web site, you will need to view the source of the page (View -> Source in Internet Explorer). Unfortunately, you must have a little bit of programming knowledge in order to know what to look for when it comes to extracting code. Hint: some Java HTML tags begin with "<script language="javascript">". The ending tags have a forward slash in them (</script>) which denote the end of the script.

Infopackets Reader Kenneth K. wrote in shortly after this article was sent out to our Readers:

" Dennis, I just finished reading your latest article. I have some additional comments to make. First of all, copying and pasting Java may not be as simple as you suggest. If the Java Clock Annie is referring to is an 'applet', it may not be copy-able as some applet elements invoke an external file at compile time.

On the other hand, if the Java code is 'client side JavaScript', and the JavaScript is 'internal' (I.E.: the JavaScript source code is completely embedded in the HTML source code instead of being in a separate file "external" file), it may be possible to copy part of the HTML source code as you suggest. Also, keep in mind that some source code is copyright, even if it is distributed via the web. "

RE: Extracting Java Code

One approach to extracting Java from a web site is to click View -> Source (using Internet Explorer), and paste it all the contents into a designated text editor that provides you with HTML color-coded markup. Some editors can even identify scripts embedded in HTML code; in fact, my absolute favorite text editor (EditPad Pro, $39.95 by JG Soft, free trial) can separate / color code Java Script from HTML without any problems. It's also great for programming scripts because it identifies syntax statements, making it easier to program.

Alternative Solutions from Infopackets Readers?

If you know of a freeware text editor capable of color coding (and separating) HTML code from Java, feel free to email me your solution.

Rate this article: 
No votes yet