• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error regarding Compiling different classes  RSS feed

 
Dhananjay Deshmukh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So i m basically using Linux as OS and terminal to compile and run project. I also have eclipse installed just in case to understand. So i was just trying a simple inheritance programs. Below is the code:
Whenever i execute above program through terminal, I get following error:


However, whenever i execute the above programs in eclipse i get the correct output. I m confused as to why am i not getting the output from terminal. All the package and class i have included are correct. Please help me understand why JVM shows error
 
Paweł Baczyński
Bartender
Posts: 2075
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your folder structure and a commend you use to compile.

I compiled your code and it works fine.

By the convention, package names should begin with lower-case and class names should not contain underscores.
 
Dhananjay Deshmukh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paweł Baczyński wrote:Please post your folder structure and a commend you use to compile.

I compiled your code and it works fine.

By the convention, package names should begin with lower-case and class names should not contain underscores.


I have attached the screenshot for the directory structure and following is the command i use:


Sorry i m late to reply, had an interview.
Screenshot-from-2015-07-09-18-49-06.png
[Thumbnail for Screenshot-from-2015-07-09-18-49-06.png]
Directory Structure
 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should execute the javac command from the parent directory of the package, not from within the package.


Paweł Baczyński wrote:By the convention, package names should begin with lower-case and class names should not contain underscores.

Please follow these instructions.
 
Dhananjay Deshmukh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tapas Chand wrote:You should execute the javac command from the parent directory of the package, not from within the package.


Paweł Baczyński wrote:By the convention, package names should begin with lower-case and class names should not contain underscores.

Please follow these instructions.


Yes i will keep that in mind. Thanks for this, It never occurred to me that since this is under the package i should use the command this way. Following is the output i get now :
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!