{"record":{"id":"3515ed651e502367","repo":"languagetool-org/languagetool","slug":"no-java-rules-found-start-this-script-from-the-l","errorCode":null,"errorMessage":"No Java rules found - start this script from the languagetool-standalone directory","messagePattern":"No Java rules found - start this script from the languagetool-standalone directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/RuleOverview.java","lineNumber":167,"sourceCode":"\n      // activity:\n      int commits = activity.getActivityFor(lang, 365/2);\n      int width = (int) Math.max(commits * 0.25, 1);\n      String images = \"\";\n      if (width > 50) {\n        images += \"<img title='\" + commits + \" commits in the last 6 months' src='images/bar-end.png' width='22' height='10'/>\";\n        width = 50;\n      } else if (width == 1 && commits > 0) {\n        width = 3;\n      }\n      images += \"<img title='\" + commits + \" commits in the last 6 months' src='images/bar.png' width='\" + width + \"' height='10'/>\";\n      System.out.print(\"<td valign=\\\"top\\\" align=\\\"right\\\"><span style='display:none'>\" + commits + \"</span>\" + images + \"</td>\");\n\n      System.out.println(\"</tr>\");    \n    }\n      \n    if (overallJavaCount == 0) {\n      throw new RuntimeException(\"No Java rules found - start this script from the languagetool-standalone directory\");\n    }\n\n    System.out.println(\"</tbody>\");\n    System.out.println(\"</table>\");\n  }\n\n  private int countRulesForLanguage(Language lang) throws IOException {\n    List<String> ruleFileNames = lang.getRuleFileNames();\n    int count = 0;\n    for (String ruleFileName : ruleFileNames) {\n      final URL url = this.getClass().getResource(ruleFileName);\n      if (url != null) {\n        String xmlRules = StringTools.readStream(Tools.getStream(ruleFileName), \"utf-8\");\n        xmlRules = xmlRules.replaceAll(\"(?s)<!--.*?-->\", \"\");\n        xmlRules = xmlRules.replaceAll(\"(?s)<rules.*?>\", \"\");\n        count += countXmlRules(xmlRules);\n        count += countXmlRuleGroupRules(xmlRules);\n      }","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/RuleOverview.java#L149-L185","documentation":"RuleOverview.run counts Java rules while emitting an HTML overview and throws a RuntimeException if overallJavaCount is zero, indicating the script was run from a directory where Java rule classes could not be discovered. The message tells the user the required working directory.","triggerScenarios":"Running the RuleOverview script from a directory other than languagetool-standalone, so classpath scanning finds no Java rule classes.","commonSituations":"Executing the dev script from the repo root, from languagetool-dev, or via an IDE with the wrong working directory configured.","solutions":["Run the script from the languagetool-standalone directory as the message instructs","If using an IDE/Maven, set the working directory to languagetool-standalone","Verify the standalone jar/module with Java rules is on the classpath"],"exampleFix":"// before\ncd languagetool-dev && mvn exec:java -Dexec.mainClass=org.languagetool.dev.RuleOverview\n// after\ncd languagetool-standalone && mvn exec:java -Dexec.mainClass=org.languagetool.dev.RuleOverview","handlingStrategy":"validation","validationCode":"if (!new File(\"languagetool-standalone\").exists() || !Paths.get(System.getProperty(\"user.dir\")).getFileName().toString().equals(\"languagetool-standalone\")) {\n  throw new IllegalStateException(\"Run from languagetool-standalone\");\n}","typeGuard":null,"tryCatchPattern":"try { new RuleOverview().run(lang); } catch (RuntimeException e) { if (e.getMessage().contains(\"No Java rules found\")) { System.err.println(\"cd languagetool-standalone and retry\"); } }","preventionTips":["Always run RuleOverview with languagetool-standalone as the working directory","Set the IDE run-configuration working directory explicitly","Script the invocation so the working directory is guaranteed"],"tags":["working-directory","dev-tool","classpath"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}