Client Help
Ok. I am... Stuck. Out of options.
What ive done is created and hosted a text file with five characters in it. Nothing else. (0.1.4)
Ive got 2 classes in the client.
I want java to read the 0.1.4 into a string called versionFromUrl, then the string goes through an if statement. If this string is equal to that string then set var1 to be blah, else, blahblah. However, no matter what I do, the outcome is always "New update available". No idea where I should call the URLReader void. Or even how, Im kinda useless at network programming :P Any help will be awesome
What ive done is created and hosted a text file with five characters in it. Nothing else. (0.1.4)
Ive got 2 classes in the client.
Update.java
Code:
public class Update {
private static Blood main;
private static URLReader urlr;
public static String var1;
public static void update() {
if(main.CLIENT_VERSION == urlr.versionFromUrl) {
var1 = "Client is up to date.";
} else {
var1 = "New update is available.";
}
}
}
URLReader.java
Code:
import java.net.*;
import java****.*;
public class URLReader {
public static String versionFromUrl;
public static void main(String[] args) throws Exception {
URL versionurl = new URL("http://pastehtml.com/view/d7dry29db.txt");
URLConnection vu = versionurl.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(vu.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
versionFromUrl = in.readLine();
System.out.println(inputLine);
}
in.close();
}
}
I want java to read the 0.1.4 into a string called versionFromUrl, then the string goes through an if statement. If this string is equal to that string then set var1 to be blah, else, blahblah. However, no matter what I do, the outcome is always "New update available". No idea where I should call the URLReader void. Or even how, Im kinda useless at network programming :P Any help will be awesome



:P