java - Yet another 'cannot find symbol' error when creating a new class object -
in short, i'm trying instantiate within main method in order handle computations. wrote main class in eclipse , able compile , run smoothly.
main method:
public static void main(string[] args) { ... outsideclass class = new outsideclass(); ... }
i ran in eclipse, worked smoothly until got error due to insufficient privileges, led me switch on using cmd.exe administrator.
i navigated eclipse folder had classes saved , ran javac x.java
each file in folder, 1 one. able javac outsideclass.java
without errors, though when came javac main.java
, received following error:
main.java:36: error: cannot find symbol outsideclass outside = new outsideclass(); ^ symbol: class outsideclass location: class main main.java:36: error: cannot find symbol outsideclass outside = new outsideclass(); ^ symbol: class outsideclass location: class main 2 errors
the outsideclass
doesn't have defined constructor, though don't know if matters or not.
the java compiler needs source (.java
) or bytecode (.class
) of outsideclass
when compiling main.java
.
try javac *.java
, or javac -cp outsideclass.class main.java
provide outsideclass
's definition compiler when compiling main
.
it more customary java developers compile java sources of single project via 1 javac
invitation, either directly, or via tool such maven.
Comments
Post a Comment