Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:33 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:30 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:25 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:19 PM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 19, 2019, 12:36:06 PM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 19, 2019, 12:35:49 PM
    • Codar: Come join us while we're fresh we're growing fast!! @ [link]
      September 18, 2019, 09:30:25 PM
    • Codar: New RSPS come check us out! @ [link]
      September 18, 2019, 04:07:24 AM
    • Codar: Released a new server come check us out! @ [link]
      September 18, 2019, 02:08:23 AM
    • ragnoroker: RuneGuild will be hosting some tournaments later to win some mystery boxes, join here : [link]
      September 16, 2019, 09:50:10 AM
    • calemx: death's-server has officially been released, come check us out  - [link]
      September 13, 2019, 04:14:21 AM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 12, 2019, 12:26:40 PM
    • cbrophy: would my account from 2013 work?
      September 12, 2019, 05:04:43 AM
    • ragnoroker: RuneGuild has officially been released, come check us out - [link]
      September 11, 2019, 11:26:35 AM
    • ragnoroker: RuneGuild has officially been released, come check us out - [link]
      September 11, 2019, 11:26:31 AM
    • ragnoroker: RuneGuild is due to be released tomorrow! First few players will recieve some goodies. Sign up on our website [link] Join our discord for updates [link]
      September 07, 2019, 07:43:28 PM
    • ragnoroker: RuneGuild is due to be released tomorrow! First few players will recieve some goodies. Sign up on our website [link] Join our discord for updates [link]
      September 07, 2019, 07:42:59 PM
    • ChrisMeadows: Yo, what's the forum's discord?
      September 04, 2019, 08:33:06 PM
    • newerarsps: i cannot register to rsps list anyone can help?
      September 01, 2019, 11:24:00 PM
    • PavSwag: Date Registered: July 03, 2012, 03:54:45 PM Think im just as good vet as u man, + I have over 80B in rs3 think im good on anyones 100k ass lookin bank b oi
      August 27, 2019, 10:48:09 AM

    Author Topic: [Any] Client Launcher/Updater  (Read 6667 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineFox2007

    • Member
    • ****
    • Posts: 567
    • Thanks: +0/-0
      • View Profile
    [Any] Client Launcher/Updater
    « on: February 24, 2014, 12:10:22 AM »
    First, no I did not choose to livestream the jar file, this would consume a lot of bandwidth on large servers and some people use shitty hosting with limited bandwidth. This was also just something I made in my spare time to learn something about swing, so please no hate ;_;

    You could also use this to get rid of the shitty checking in most 317 clients where you have to change a number and all that other shit. This will compare dates to the file stored online, and if It's newer it will prompt you for the download. Works only for clients, not the cache.
    ----------
    Preview:
    (click to show/hide)


    First, you need to make a new folder, call it whatever you like. Then inside, you need to make this structure:


    • Main Folder
      -- bin/ (output folder)
      -- src/
      ---- Launcher.java
      ---- Splash.java
    Splash.java:
    Code: Java
    1. importjavax.swing.*;
    2.  /**
    3.   * @author King Fox
    4.   */
    5. publicclass Launcher {
    6.    
    7.     publicstaticvoid main(String[] args){
    8.         final Splash s =new Splash();
    9.          s.setVisible(true);
    10.          SwingUtilities.invokeLater(newRunnable(){
    11.              publicvoid run()  {
    12.                   s.setVisible(true);
    13.              }
    14.          });
    15.     }
    16.  
    17. }
    18.  

    Launcher.java:
    Code: Java
    1. importjavax.swing.*;
    2.  
    3.  
    4. importjava.awt.*;
    5. importjava.io.*;
    6. importjavax.swing.*;
    7. importjava.io.*;
    8. importjava.net.*;
    9.  
    10. @SuppressWarnings("serial")
    11. publicclass Splash extendsJFrame{
    12.  
    13. // START EDIT
    14.    privatestaticString downloadUrl =";; // the download url
    15.   private static String fileName = "SomeJar.jar"; // the name you wish to save it as
    16.   private static String serverName = "Foxtrot"; // the server name
    17.   private static String backgroundImageUrl = ";;// url to a background image
    18.    privatestaticString saveDirectory =System.getProperty("user.home")+"/Desktop/";// the location where you wish to store the Jar
    19. // END EDIT
    20.  
    21.    publicstaticURL url;
    22.    privateJLabel imglabel;
    23.    privateImageIcon img;
    24.    privatestaticJProgressBar pbar;
    25.    Thread t =null;
    26.  
    27.    public Splash(){
    28.       super("Splash");
    29.        
    30.       File file =newFile(saveDirectory + fileName);
    31.        
    32.       try{
    33.          url =newURL(downloadUrl);
    34.       }catch(MalformedURLException e){
    35.          e.printStackTrace();
    36.       }
    37.      
    38.       setSize(543, 391);
    39.       setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    40.       setLocationRelativeTo(null);
    41.       setUndecorated(true);
    42.        
    43.       try{
    44.          img =newImageIcon(newURL(backgroundImageUrl));
    45.       }catch(MalformedURLException e1){
    46.          e1.printStackTrace();
    47.       }
    48.        
    49.       imglabel =newJLabel(img);
    50.       add(imglabel);
    51.       setLayout(null);
    52.       pbar =newJProgressBar();
    53.       pbar.setMinimum(0);
    54.       pbar.setMaximum(100);
    55.       pbar.setStringPainted(true);
    56.       pbar.setForeground(Color.LIGHT_GRAY);
    57.       imglabel.setBounds(0, 0, 543, 391);
    58.       add(pbar);
    59.       pbar.setPreferredSize(newDimension(310, 30));
    60.       pbar.setBounds(70, 320, 404, 20);
    61.  
    62.  
    63.       try{
    64.          if(file.exists()){
    65.             URLConnection connection = url.openConnection();
    66.             connection.connect();
    67.             long time = connection.getLastModified();
    68.             if(time > file.lastModified()){
    69.                if(!startDialogue()){
    70.                   startApplication();
    71.                   return;
    72.                }
    73.             }else{
    74.                setVisible(true);
    75.                Thread.sleep(3000);
    76.                startApplication();
    77.                return;
    78.             }
    79.          }
    80.       }catch(Exception e){
    81.          e.printStackTrace();
    82.       }
    83.        
    84.       Thread t =newThread(){
    85.  
    86.          publicvoid run(){
    87.             OutputStream dest =null;
    88.             URLConnection download;
    89.             InputStream readFileToDownload =null;
    90.             try{
    91.                dest =newBufferedOutputStream(newFileOutputStream(saveDirectory + fileName));
    92.                download = url.openConnection();
    93.                readFileToDownload = download.getInputStream();
    94.                byte[] data =newbyte[1024];
    95.                int numRead;
    96.                long numWritten =0;
    97.                int length = download.getContentLength();
    98.                while((numRead = readFileToDownload.read(data))!=-1){
    99.                   dest.write(data, 0, numRead);
    100.                   numWritten += numRead;
    101.                   int percent =(int)(((double)numWritten /(double)length)* 100D);
    102.                   pbar.setValue(percent);
    103.                   pbar.setString(""+(percent <99?"Downloading "+serverName+" - "+percent+"%":"Complete")+"");
    104.                }
    105.             }catch(Exception exception){
    106.                exception.printStackTrace();
    107.             }finally{
    108.                try{
    109.                   if(readFileToDownload !=null)
    110.                      readFileToDownload.close();
    111.                   if(dest !=null)
    112.                      dest.close();
    113.                   Thread.sleep(1000L);
    114.                   startApplication();
    115.                }catch(IOException|InterruptedException ioe){
    116.                
    117.                }
    118.             }
    119.          }
    120.       };
    121.       t.start();
    122.    }
    123.    
    124.    publicboolean startDialogue(){
    125.       setVisible(true);
    126.       int selection =JOptionPane.showConfirmDialog(null, "An update is available. Do you wish to download?", "Update Available", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
    127.       return selection ==JOptionPane.OK_OPTION;
    128.    }
    129.  
    130.  
    131.    /**
    132.    * Launches the downloaded Jar file and closes the progress bar
    133.    */
    134.    publicstaticvoid startApplication(){
    135.       try{
    136.          Runtime.getRuntime().exec("java -jar "+(saveDirectory + fileName)+"");
    137.          Thread.sleep(1000L);
    138.          System.exit(0);
    139.       }catch(IOException|InterruptedException e){
    140.          e.printStackTrace();
    141.       }
    142.    }
    143.  
    144. }
    145.  

    Suggested you do this with an IDE such as Eclipse.
    Hopefully someone finds use for it ^-^ Splash.java contains all the information you need to edit.
    « Last Edit: February 25, 2014, 07:53:46 PM by Fox2007 »
    Foxtrot Studios - The next generation of java and web-development
    Runescape Gambling

    OfflineVain_

    • Member
    • ****
    • Posts: 3,057
    • Thanks: +0/-0
      • View Profile
    Re: [Any] Client Launcher/Updater
    « Reply #1 on: February 24, 2014, 09:27:44 AM »
    useful to pushing out updates, but only if the user chooses to download it. id remove the prompt and just download it directly.

    another alternative would be runajar,  but of course will only be useful to servers with large bandwidth. it essentially runs the archive from the URL, without downloading anything except the cache. would basically run the client on the webserver, which would only be updated by the host.

    I use runajar personally because I can have one jar file, and quite a few shell scripts/batch commands and run any number of clients I want, only using different parameters. it saves hd space for all the servers I play from time to time.
    Runescape Gambling

    Offlinelare69

    • Member
    • ****
    • *
    • Posts: 5,322
    • Thanks: +0/-0
      • View Profile
    Re: [Any] Client Launcher/Updater
    « Reply #2 on: March 11, 2014, 07:30:39 AM »
    useful to pushing out updates, but only if the user chooses to download it. id remove the prompt and just download it directly.

    another alternative would be runajar,  but of course will only be useful to servers with large bandwidth. it essentially runs the archive from the URL, without downloading anything except the cache. would basically run the client on the webserver, which would only be updated by the host.

    I use runajar personally because I can have one jar file, and quite a few shell scripts/batch commands and run any number of clients I want, only using different parameters. it saves hd space for all the servers I play from time to time.
    NERD

    just kidding :) pretty good release although I agree that they shouldn't be prompted and it should just download directly
    hi. check out luna:)
    Runescape Gambling

    Offlinetaymor46

    • First Time Poster
    • *
    • Posts: 3
    • Thanks: +0/-0
      • View Profile
    Re: [Any] Client Launcher/Updater
    « Reply #3 on: September 07, 2016, 11:52:29 AM »
    can any one help me to add this auto client updater to my server
    ill pay for him!!

    skype : taymor gadban

    mail : [email protected]

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal