Well, here is something I was quite proud of. If you use this, the client the uses will download is only 5kb. It uses your webclients archive and loads that.
Don't ask me how to get it working for your server, because I won't help.
Note: This was STRICTLY made for MY server, you will need to edit the substrings, etc for it to work for you(most people wont be able to get it to work for them).
Code:
import java.applet.Applet;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;
import javax.swing.*;
public class Launcher {
public static JFrame clientFrame;
public static JPanel clientPanel = new JPanel();
public static void main(String[] args) {
try {
String pageSource = getPageSource();
String fileLocation = pageSource.substring(pageSource.indexOf("archive=")+9, pageSource.indexOf("archive=")+31);
URL url = new URL("http://play.silvarea.com/"+fileLocation);
URLClassLoader classLoader = new URLClassLoader(new URL[]{(url)});
Applet client = (Applet) classLoader.loadClass("Loader").newInstance();
client.init();
client.start();
clientFrame = new JFrame("Silvarea Client | Version: "+getWebVersion());
clientFrame.setLayout(new BorderLayout());
clientPanel.setLayout(new BorderLayout());
clientPanel.add(client);
clientPanel.setPreferredSize(new Dimension(800, 540));
clientFrame.getContentPane().add(clientPanel, "Center");
InputStream stream = Launcher.class.getResourceAsStream("/icons/icon.png");
BufferedImage image = ImageIO.read(stream);
clientFrame.setIconImage(image);
clientFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
clientFrame.pack();
clientFrame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getPageSource() throws IOException {
URL website = new URL("http://play.silvarea.com/");
HttpURLConnection connection = (HttpURLConnection) website.openConnection();
connection.setRequestMethod("GET");
InputStream input = connection.getInputStream();
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int bytes = 0;
while((bytes = input.read(buffer)) != -1) {
output.write(buffer, 0, bytes);
}
input.close();
output.close();
return new StringBuilder().append(output).toString();
}
public static double getWebVersion() throws IOException {
String pageSource = getPageSource();
String fileLocation = pageSource.substring(pageSource.indexOf("archive=")+9, pageSource.lastIndexOf(".jar")+4);
double version = Double.parseDouble(fileLocation.substring(15, fileLocation.length()-4));
return version;
}
}