Aufhebung des Jesuitenordens
In 1768, he moved to Ljubljana, where he since 1769 taught mathematics, mechanics, hydraulics and engineering at the School of Mechanical Engineering in Ljubljana (German: "Laibach"). The school taught classes in shipbuilding, port devices and structures, and Gruber's wish was to build a dockyard nearby. That enterprise proved to be prohibitively expensive. From 1772 until 1781 Gruber was the director of the navigation direction in Ljubljana, which took custody of the improvement of navigation on the Sava, the Kolpa and the Ljubljanica. After the Suppression of the Society of Jesus by Pope Clement XIV, in 1773, Gruber remained as engineer at the court of Emperor Joseph II until 1784.