• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error regarding Compiling different classes

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2236
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic