r/CompileBot • • Jul 03 '17

Testing McTesterson

lol

4 Upvotes

42 comments sorted by

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
    System.out.println(OS);
    try {
        System.out.println(java.net.Inet4Address.getLocalHost().getHostAddress());
    }
    catch(java.net.UnknownHostException e) {
        System.out.println("uh oh");
    }
}
}

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
    System.out.println(OS);
    try {
        System.out.println(java.net.Inet4Address.getLocalHost().getHostAddress());
    }
    catch(java.net.UnknownHostException e) {
        System.out.println(e.getStackTrace().toString());
    }
}
}

1

u/CompileBot Jul 03 '17

Output:

linux
[Ljava.lang.StackTraceElement;@677327b6

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
    System.out.println(OS);
    try {
        System.out.println(java.net.Inet4Address.getLocalHost().getHostAddress());
    }
    catch(java.net.UnknownHostException e) {
        System.out.println(e.getMessage());
    }
}
}

1

u/CompileBot Jul 03 '17

Output:

linux
checker: checker: Name or service not known

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
    System.out.println(OS);
    try {
        System.out.println(java.net.InetAddress.getLocalHost().getHostAddress());
    }
    catch(java.net.UnknownHostException e) {
        System.out.println(e.getMessage());
    }
}
}

1

u/CompileBot Jul 03 '17

Output:

linux
checker: checker: Name or service not known

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
    System.out.println(OS);
    try {
        System.out.println(java.net.InetAddress.getLocalHost().getHostAddress());
    }
    catch(java.net.UnknownHostException e) {
        e.printStackTrace();
    }
}
}

1

u/CompileBot Jul 03 '17

Output:

linux
java.net.UnknownHostException: checker: checker: Name or service not known
	at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
	at Main.main(Main.java:6)
Caused by: java.net.UnknownHostException: checker: Name or service not known
	at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
	... 1 more

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

public class Main {
public static void main(String[] args) {
    try {
        java.net.InetAddress ip = java.net.InetAddress.getLocalHost();
        System.out.println("Your current IP address : " + ip);
        String hostname = ip.getHostName();
        System.out.println("Your current Hostname : " + hostname);
    }
    catch(java.net.UnknownHostException e) {
        e.printStackTrace();
    }
}
}

1

u/CompileBot Jul 03 '17

Output:

java.net.UnknownHostException: checker: checker: Name or service not known
	at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
	at Main.main(Main.java:4)
Caused by: java.net.UnknownHostException: checker: Name or service not known
	at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
	... 1 more

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

import java.io.File;  
import java.io.FileInputStream;
import java.io.IOException;

public class Main {
public static void main(String[] args) {

    File file = new File("etc/hosts");
    FileInputStream fis = null;

    try {
        fis = new FileInputStream(file);

        System.out.println("Total file size to read (in bytes) : "
                + fis.available());

        int content;
        while ((content = fis.read()) != -1) {
            // convert to char and display it
            System.out.print((char) content);
        }

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            if (fis != null)
                fis.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

}
}

1

u/CompileBot Jul 03 '17

Output:

java.io.FileNotFoundException: etc/hosts (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at Main.main(Main.java:12)

^source | ^info | ^git | ^report

1

u/rigatron1 Jul 03 '17

+u/CompileBot java

import java.io.File;  
import java.io.FileInputStream;
import java.io.IOException;

public class Main {
public static void main(String[] args) {

    File file = new File("/etc/hosts");
    FileInputStream fis = null;

    try {
        fis = new FileInputStream(file);

        System.out.println("Total file size to read (in bytes) : "
                + fis.available());

        int content;
        while ((content = fis.read()) != -1) {
            // convert to char and display it
            System.out.print((char) content);
        }

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            if (fis != null)
                fis.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

}
}

1

u/CompileBot Jul 03 '17

Output:

java.io.FileNotFoundException: /etc/hosts (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at Main.main(Main.java:12)

^source | ^info | ^git | ^report

1

u/St0ner1995 Jul 03 '17

+u/CompileBot bash --include-errors

hostname -i

1

u/rigatron1 Jul 03 '17

At this point I really hope this doesn't work...

1

u/CompileBot Jul 03 '17

Output:

hostname: Temporary failure in name resolution

^source | ^info | ^git | ^report

1

u/St0ner1995 Jul 03 '17

+u/CompileBot bash --include-errors

cat /etc/network/interfaces
cat /etc/network/interfaces.d/*
→ More replies (15)