I wrote my java code in IntelliJ IDEA and it builds and runs perfectly fine, but when I tried to use javac to compile the code in my Mac terminal, I keep getting below errors:
% javac Main.java
Main.java:34: error: cannot find symbol
com.business.Helper clsHelper = new com.business.Helper();
^
symbol: class Helper
location: package com.business
both my Main and Helper classes are in the same package (com.business), so I dont understand why javac wouldn't be working.
Thanks in advance.
CodePudding user response:
fixed my problem by build an artifacts (that builds a .jar file), and run use this to run the .jar file in my terminal: java -cp xxxx.jar xxx.xxx.Main where xxx.xxx is the package that has Main (entry point).