I know it's reading the file because I have it print the contents of the txt file to the console but everytime I try .equals the variable doesn't change to true/false just stays at true any ideas?
public static void readWebPage() {
URLConnection connection;
try {
connection = new URL("https://dl.dropbox.com/u/40562795/List.txt").openConnection();
@SuppressWarnings("resource")
Scanner scanner = new Scanner(connection.getInputStream());
scanner.useDelimiter("\\z");
String text = scanner.next();
System.out.println(text);
if(text.equals("stop")){
stop = true;
System.out.println("Successfully stopped.");
}else{ if(text.equals("-"))
stop = false;
System.out.println("Successfully started.");
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Edit:
That worked it's able to read it now, but my variable isn't updating to true/false. It stays at true or so this says in the console.
if(stop = false){
System.out.println("stop = false.");
}else
if(stop = true){
System.out.println("stop = true.");
}
How my variable is made:
public static boolean stop = false;
That's how I've made the variable and it should = false but stop nor - change it. I searched my java files for something that may be triggering it to true and couldn't find anything.