FreeRouter for KiCad working in offline

KiCad has some built-in auto routing capabilities for laying out PCB wires. More advanced version, online auto-router from www.freerouting.net, can cooperate with KiCad and gives better results.  FreeRouter however does not work in offline even after copying Java Web Start resources to local system; auto-router still checks internet access on startup. Irritated I hacked binaries and got rid of online check. Now you can make your auto-router working anytime.

Note: for recent Kicad versions (2015 and later) there is simpler way to make Freerouter and Kicad cooperating, for details refer to my post on it.

Last year I started my play with home-made PCBs with EaglePCB, very popular software among hobbyists. I am working on project that may go commercial so I decided to move to KiCad because of obvious reason: licensing. EaglePCB has spoiled me with auto routing capabilities which I was using in first attempts to lay out wires on prototype boards to save on time. Online auto-routing does no satisfy my needs so I decided to make my offline version inside KiCad installation.

FreeRouter in KiCad

FreeRouter in KiCad

First step was is get Java Web Start resources. Get these four resources downloaded:

and placed in ./bin of KiCad directory. You can find freeroute.jnlp existing in KiCad installation, this way GUI starts auto-router; we are about to replace it. Next, modify both JNLP files to make codebase referring to local resources i.e. replace codebase=”http://freerouting.net/java” with codebase=”file://localhost/your_path_to_kicad_bin”. Make sure you use absolute path and path does not contain white spaces, otherwise Java Web Start will not pick up JAR files; in my case it is codebase=”file://localhost/C:/Developer/KiCad/bin”.

At this point it will not work yet. You can disable network in your OS, run KiCad, enter pcbnew to open auto-router and after accepting Java security messages router will start just to display: Internet connection required to start the Freerouter application!

Inet access just to get one file

Inet access just to get one file

With network sniffer I have discovered it only accesses website at the beginning just to read http://www.freerouting.net/java/online_check.txt file. Whether the author intent was to make placeholder for some logic to be placed on server-side later, to collect some usage statistics, or whatever else, from user perspective working while traveling it is pain in the ass.

I took a look inside decompiled code just to confirm my observation: the application denies work if UserOnline class cannot reach out to text file on the web. Since the JARs are not sealed (signed) I have created replacement version of this class just to confirm it works fine in complete offline.

Class replacement

Class replacement

Last steps you need to do is to take this UserOnline.class, browse the router.jar content with any archive tool like 7-zip, replace original class router.jar!/gui/UserOnline.class and save. Voila! Launch auto-router again and it works in offline perfectly now.

Disclaimer: As of writing of this article I could not verify if hack breaks licensing model of FreeRouter in any way as the www.FreeRouting.net website does not verbalize license or limitations in any way.

This entry was posted in Electronics, Software and tagged . Bookmark the permalink.

14 Responses to FreeRouter for KiCad working in offline

  1. Arthur says:

    At least in the KiCAD forum, Alfons has said repeatedly that he had GPL licensed the code.

    I don’t know if he had the license posted on his website, or if he actually did all the steps in the instructions on how to mark the executables as GPL’d but that doesn’t really matter.

    The important thing is that under the GPL, you DO have rights to the software as long as you post the source for any modifications. That is the point of the GPL.

    At most, if you were to post the modified code with source is that it would be considered as a “fork” of the original project.

    • andy says:

      Oh, I missed the fact it was GPLed. I am not sure how it would adds to the story between Alfons and his ex-employer if someone republishes code/binaries that was asked to be removed. My own offline copy is nearly one year old and never updated as it works as expected that’s also why I redirect people to latest-greatest somewhere in the internet.

  2. Tim says:

    Hey Andy,

    I searched and could not find the router files and such. It would be nice if you could share your files…I use freepcb.

  3. Dani says:

    Java 7. Unable to launch the application. I should use java 6 ? How can I pass this error?

    • andy says:

      It works with JDK7, I still use it (instead of Java8). What error do you have, just “unable to launch the application”? Have you enabled java console from java control panel?

  4. Dani says:

    Than you for your answer. The problem was like you sad. “codebase=”file://localhost/your_path_to_kicad_bin”. Make sure you use absolute path and path does not contain white spaces, otherwise Java Web Start will not pick up JAR files; in my case it is codebase=”file://localhost/C:/Developer/KiCad/bin”.”

    More detailed this line “file://localhost/C:/Developer/KiCad/bin”. Instead of developer i had to put Program Files.
    “file://localhost/C:/Program Files/KiCad/bin”
    If i remember well there where 2 files where i did this minor modification.

  5. afs says:

    how about in linux? i use debian.

    i tried “codebase=”/usr/local/bin”” where kicad excutable is installed, but it didn’t work.

    (java runtime 6 installed)

    • andy says:

      I guess protocol is missing i.e. file://usr/local/bin

      • Anonymous says:

        i installed jdk 7 and it worked. i don’t know why but java webstart asked for version 7 of jdk.

        thanks for the tutorial, it helped a lot.

  6. tmort says:

    I used freerouter in offline mode for a project, but, when I sent my gerbers to the PCB vendor they didn’t include the routing layer.

    I had previously designed this board before freerouter went offline and swapped that layer. I didn’t change that part. I had to redo the gerbers because I had a couple extraneous drill holes outside the board area and was missing a board outline layer.

    The PCB vender couldn’t use the old txt file for the routes.

    I was told the output is a .ses file, but, gerbview can’t read it. I’m not really sure where standalone autorouter would have saved any output or what it might have been called.

    Just to further complicate things, I had to re-install my OS (mint 17.2). I do have a file backup from when I did the autooute work. I just don’t know what to look for.

    Can anyone help?

    • andy says:

      You do not need Freerouter to re-create gerber and drill files. Freerouter is about automatic traces generation and it co-works with Kicad — you export DSN file from Kicad to Freerouter, autoroute there and then import back SES file to Kicad pcbnew. All that is well covered here.

      So if you have KiCAD project, you need to modify it as expected and regenerate drill files (using plot function in pcbnew). If you have lost PCB design (.kicad_pcb file) but you have session file from Freerouter, then you can open empty PCB design, import back .ses file and generate gerber again, as documentation says.

Leave a Reply

Your email address will not be published.