Edit: I was forgot to change the start class to the client package in Eclipse!
This is odd, it works fine in eclipse, then I export it and it gives me a java.lang.NumberFormatException .
The pastebin of Start.java
The dump:
Exception in thread "main" java.lang.NumberFormatException: For input string: "gudenau.no-ip.org"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.<init>(Unknown Source)
at com.gudenau.ChatServer.Start.main(Start.java:141)
I don't get why it works in eclipse but not with a batch file.
The code I use for the socket is
socket = new Socket("gudenau.no-ip.org", 45678);
I will change this to not be static later.
try {
socket = new Socket("gudenau.no-ip.org", 45678);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
} catch (NumberFormatException e) {
e.printStackTrace();
System.exit(-1);
} catch (UnknownHostException e) {
e.printStackTrace();
System.exit(-2);
} catch (IOException e) {
e.printStackTrace();
System.exit(-3);
}
Edit the code around 141:
@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}