简体   繁体   中英

How to put an applet that is written with Netbeans into a html file?

I have written an applet that connects mysql. Since i connect mysql it uses additional library.(JDBC Driver for MySQL (Connector/J)) When i finished writing and try to run on Netbeans there is no problem but i did not figure how to put that class into a html file. Do i have to put whole netbeans project up or what should i do?

Read this tutorial from Sun/Oracle

  1. Package as jar
  2. Create jnlp
  3. Create HTML

Make the main class extends JApplet

Build the project

Find the jar

Then add this code to your HTML

<applet code = '<appletClassName>' 
    archive = '<jarFilePath.jar>', 
    width = xxx, 
    height = yyy />

If you have the JDBC driver set up in the Netbeans project properties, all you have to do is build the project and then go into your NetbeansProjects folder (wherever your Project folder is) and open up the build folder. It should have a sample HTML document along with the necessary files to run the applet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM