Search code examples
exceptiontcpmon

Anyone know how to get TCPMON working on a mac?


Please don't close this question. It is related to a tool used by programmers, and it very likely has a programmer related answer.

I'm attempting to run tcpmon on a mac that doesn't have Apache. I downloaded the from here (https://code.google.com/p/tcpmon/), and then I ran it.

$ java tcpmon-1.1.jar
Exception in thread "main" java.lang.NoClassDefFoundError: tcpmon-1/1/jar
Caused by: java.lang.ClassNotFoundException: tcpmon-1.1.jar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Now I don't have JDK on my system and all I downloaded was the JAR. I'm wondering if this is a known issue, and if there is a work around.


Solution

  • This is a known bug with tcpmon (basically the jar isn't built properly).

    JNLP

    You can just run it via the JNLP file off their website from: http://tcpmon.googlecode.com/hg/www/tcpmon.jnlp

    or

    JAR

    As per the comment #5 on the bug you can workaround it by doing rebuilding the jar as follows (this is slightly nicer version of those instructions)

    unzip -d tcpmon-1.1 ~/Downloads/tcpmon-1.1.jar
    cd tcpmon-1.1
    jar cfe ../tcpmon-1.1-fixed.jar com.codegoogle.tcpmon.MainWindow com readme.html
    cd ..
    rm -rf tcpmon-1.1
    

    Now tcpmon-1.1-fixed.jar will start with just

    java -jar tcpmon-1.1-final.jar
    

    Alternatively you can just double click on it in finder now.

    Permissions

    In either case you may need to make adjustments to the permissions on your Mac so that it can run

    If you get a message about the app not being from an identified developer go to the System Preferences and go to the General tab which will say something about not allowing tcpmon-1.1.jar to open and provide an Open button, click the Open button.

    After that you may get a message from Java saying it doesn't allow self signed code. In which case you need to go to System Preferences, Open the Java control panel, go to the security control panel and adjust appropriately (one option would be to slide the slider down to Medium). I'd recommend putting the settings back on the Java control panel after you're done.