I am currently creating a security system, and I have it to where it pulls text off of multiple files on my computer, and puts that text into a URL which grabs more text. But when I do an 'If Statement' asking the system weather the text equals true, and or false. it does not work. It does not even give me an error to work off of. Any ideas?
package net.holopanio.dev;
import java.awt.FlowLayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Security extends Object implements Runnable {
static String license;
static String ip;
static String version;
static String localIp;
static String line;
public Security(){
}
public void run() {
}
public static void main(String args[]) throws Exception {
//Ip Retriever
InetAddress addr = InetAddress.getLocalHost();
localIp = addr.getHostAddress();
license = new String(Files.readAllBytes(Paths.get("C:\\Program Files (x86)\\HoloSecurity\\Verification\\license.txt")));
ip = new String(Files.readAllBytes(Paths.get("C:\\Program Files (x86)\\HoloSecurity\\Verification\\ip.txt")));
version = new String(Files.readAllBytes(Paths.get("C:\\Program Files (x86)\\HoloSecurity\\Verification\\version.txt")));
URL url = new URL("http://ift.tt/2h1zxUr" + license + "&ip=" + ip +"&version=" + version);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
line = in.readLine();
System.out.println(line);
System.out.println("IP: " + localIp);
if(line == "false") {
JFrame frame = new JFrame("Invalid");
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JLabel label = new JLabel("Click here to get a new licence key");
JButton button = new JButton();
button.setText("Click here");
panel.add(label);
panel.add(button);
frame.add(panel);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
} else if(line == "true") {
JFrame frame = new JFrame("Security");
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JLabel label = new JLabel("Click here to get a new licence key");
JButton button = new JButton();
button.setText("Click here");
panel.add(label);
panel.add(button);
frame.add(panel);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
new Security();
}
}
Aucun commentaire:
Enregistrer un commentaire