Posts

Showing posts from August, 2009

Auto Update in Install4J - Software Update with Silent Version Check

Image
When we have a programm running on multiple client PC and we need an Auto Update. For Java Install4J provides Installer which can be used on on any platform. It is easy but very difficult as no clear help is available. AutoUpdate.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package autoupdater; import com.install4j.api.launcher.*; import com.install4j.api.update.*; import com.install4j.api.Util; import javax.swing.JOptionPane; /** * * @author rehmanm */ public class AutoUpdate { static AutoUpdate AutoUpdateObj; public static AutoUpdate getInstance(){ if (AutoUpdateObj ==null) AutoUpdateObj = new AutoUpdate(); return AutoUpdateObj; } private AutoUpdate(){ } public void Update(){ try { JOptionPane.showMessageDialog(null, "Download Location " + Util.getUserHome()); JOptionPane.showMessageDialog(null, "Possible Entry : " + UpdateCh...

Ping For All OS

The Application is written in Java and provide the time in MS and runable on all Major OS including Windows, MAC and Linux . public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Ping p = new Ping(); System.out.println((int)Float.parseFloat(p.DoPing("XX.XX.XX.XX"))); } } class Ping{ public String DoPing(String URL) { String Result = "0"; String OS = System.getProperty("os.name"); String pingCmd = "ping "; String pingResult = ""; if (OS.indexOf("Windows") != -1){ pingCmd = pingCmd + "-n 1 -l 64 "; } else { pingCmd = pingCmd + "-c 1 -s 64 "; } pingCmd = pingCmd + URL; System.out.println(pingCmd); try { Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { //System.ou...