如何在HTML中运行Java?

时间:2017-06-16 02:35:13

标签: java html

我有这个Java代码,想知道如何在HTML文件中将其作为网站运行:Password Generator by Robotter112:

import java.util.Random;

public class PasswordGenerator 
{
public static void main(String[] args)
{
int length = 10; // password length
System.out.println(generatePswd(length));
}
static char[] generatePswd(int len)
{
System.out.println("Your Password:");
String charsCaps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String chars = "abcdefghijklmnopqrstuvwxyz";
String nums = "0123456789";
String symbols = "!@#$%^&*_=+-/€.?<>)";

String passSymbols = charsCaps + chars + nums + symbols;
Random rnd = new Random();

char[] password = new char[len];
int index = 0;
for (int i = 0; i < len; i++) 
{
password[i] = passSymbols.charAt(rnd.nextInt(passSymbols.length()));

}
return password;
}
}

那么在HTML文件中可以运行这个java的HTML代码是什么?

0 个答案:

没有答案