How to output information to the browser via Java Applet? [closed]

Closed. This question is off-topic. Answers to it are not accepted at the moment.

Want to improve this question? Update the question so that it it fit into thetheme of Stack Overflow in Russian.

Closed 5 years ago.

Improve the question

I want to display information about a music composition in the browser via Java applet. I use the library beaglebuddy_mp3.jar to get id3 tags. The file folder looks like this:

applet
 - index.html
 - FirstApplet.class
 - beaglebuddy_mp3.jar

In index.html I'm connecting an applet:

<applet code="FirstApplet.class" archive="beaglebuddy_mp3.jar" width="500" height="500"></applet>

FirstApplet.class contains the following code:

import java.applet.Applet;
import java.awt.Graphics;
import java.io.File;
import java.io.IOException;

import com.beaglebuddy.mp3.MP3;
import com.beaglebuddy.id3.enums.PictureType;

public class FirstApplet extends Applet{
    public void paint(Graphics g){
        try {
            MP3 mp3 = new MP3("D:\\Music\\abc.mp3");
            g.drawString(mp3.getBand() +" "+mp3.getTitle(), 20, 20);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } 
}

After running the file index.html a warning window appears saying that I am running the app at my own risk. Then I press the " Run " button, instantly a gray square appears and disappears. Nothing is displayed on the screen.

Author: Kyubey, 2014-09-29

1 answers

There is a LiveConnect technology for sharing between Java and JavaScript-an example can be view here.

P.S. It turns out that there are still coders using applets - I haven't seen anyone for 100 years :)

 1
Author: Barmaley, 2014-10-02 19:10:25