Stack Exchange
Why am I geting a ClassNotFoundException?
Using Ubuntu
Here is my code:
import java.io.*;
import java.net.*;
import se.opendataexchange.ethernetip4j.clx.*;

class PLCServer
{
    public static void main(String argv[]) throws IOException
    {
        // IP address of the ethernet card
        String ENBTIP = "192.168.10.14";
        DataInputStream socketReader = null;
        PrintStream socketWriter = null;
        ControlLogixConnector test = new ControlLogixConnector(ENBTIP,44818);

        // Debugging code
        System.out.println(InetAddress.getByName(ENBTIP).isReachable(10000));
    }
}

Here is how I am compiling:
javac -classpath /home/nick/Java/PLC/ethernetip4j-0.2.jar PLCServer.java which returns no errors
Here is the output:
Exception in thread "main" java.lang.NoClassDefFoundError: se/opendataexchange/ethernetip4j/clx/ControlLogixConnector
    at PLCServer.main(PLCServer.java:13)
Caused by: java.lang.ClassNotFoundException: se.opendataexchange.ethernetip4j.clx.ControlLogixConnector
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 1 more

Am I missing something here?

Well how are you running the code?

I am running with java PLCServer

When you run the code, you should specify the name of the class, not the name of the source file, and you must also include libraries in your classpath. Try java -classpath /home/nick/Java/PLC/ethernetip4j-0.2.jar:. PLCServer

Also be sure you're pointing to the jar file and not the zip file. I just compiled your sample code without any issues.

Make sure you're also specifying the classpath when running your code.  If you're still having issues after adding everything you need to the java classpath, check that those missing classes are actually in the jars/locations you are specifying.  Also you can enable some debug flags to give more information on class loading, etc.
So for example...
java -classpath /home/nick/Java/PLC/ethernetip4j-0.2.jar:. PLCServer


Well now that I included the classpath here is what I get
nick@ubuntu:~/Java/PLC$ java -classpath /home/nick/Java/PLC/ethernetip4j-0.2.jar PLCServer Error: Could not find or load main class PLCServer

@CupONoodles make sure you also include the current directory . in the classpath.

Silly me I forgot the :. Thanks much
