user3444567
user3444567

Reputation: 1

Java files are not compliling

I have deploy my java code on AWS cloud, when I compile it on windows through terminal, I just have to use the command.

javac mainApp.java

it automatically create .class files of all other classes, lets say I have another class

class newProcessClass

who's variable is in mainApp.java, on EC2 when I compile it, it is giving me the error

error: could not find this symbol
          newProcessClass npc = new newProcessClass();

same for the other classes. how can I compile it, and run it.

Upvotes: 0

Views: 44

Answers (2)

Tahuri
Tahuri

Reputation: 11

I recommend use Maven for the life cycle for application java and when you compiled the mainApp.java this action has that compile all file. you can get me more information of error stack?. For other side I think that is best that you use Maven. Best regards

Upvotes: 0

Lawrence Liu
Lawrence Liu

Reputation: 489

According to your description, I think that might be caused by classpath issue,

So please make sure current path(.) is under your classpath.

  • You can do this by type the follow into your terminal(pay attention to the little dot please!)

    export CLASSPATH=.;$CLASSPATH

  • If you would like to persistent this setting and avoid set this everytime, you'd better add it to your .bashrc file.

  • And then when you run the class via java command, please also specify classpath as below

    java -cp . mainApp

Upvotes: 1

Related Questions