Reid Posted January 7, 2014 Posted January 7, 2014 Enjoy /** * @author Reid (PurpleKush) * @param currVersion * @param txtLoc * @throws IOException */ public static void versionCheck(final String currVersion, final String txtLoc) throws IOException { final URL url = new URL(txtLoc); final BufferedReader file = new BufferedReader(new InputStreamReader(url.openStream())); final String onlineVersion = file.readLine(); file.close(); if (!onlineVersion.equals(currVersion)) { System.out.println("Version is Out of date"); JOptionPane.showMessageDialog(null,"Script is Out of date, get latest jar from thread!!!"); } else { System.out.println("Version is Up to date"); } }
Jack Posted January 7, 2014 Posted January 7, 2014 so u host the text file on a website? where can i host?
BotRS123 Posted January 7, 2014 Posted January 7, 2014 Where was this a month ago? I did enjoy trying to figure it out.
Toph Posted January 7, 2014 Posted January 7, 2014 (edited) uh how do I run dat doe call versionCheck(final String currVersion, final String txtLoc) where currVersion is the local script's current version, and txtLoc is the location of an online .txt file containing only the version number (or a blank HTML site containing the same thing). Poor implementation, imo. Should be a boolean returning if it's current, not a void. Edited January 7, 2014 by Toph
Reid Posted January 7, 2014 Author Posted January 7, 2014 call versionCheck(final String currVersion, final String txtLoc) where currVersion is the local script's current version, and txtLoc is the location of an online .txt file containing only the version number (or a blank HTML site containing the same thing). Poor implementation, imo. Should be a boolean returning if it's current, not a void. Agreed, this was one of my first java project lol i haven't updated it 1
mirojantti Posted January 15, 2014 Posted January 15, 2014 soo how do I use this? I have own website where I can host a html file containing the current version, but how do I get it to this script? Do I have to replace te textLoc and currVersion with something? please someone help me
While Posted January 16, 2014 Posted January 16, 2014 soo how do I use this? I have own website where I can host a html file containing the current version, but how do I get it to this script? Do I have to replace te textLoc and currVersion with something? please someone help me txtLoc is the location of the file with the version and current version is....the current version