• 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

Linux and Java command

 
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am facing a problem whose reason i am unable to understand.
I am running linux on my syatem,and java version 7.0.
When i try to compile a code it does fine,but running a code by java command always gives the error that 'Main method not found.please declare it as pulic static void main(String[] args',even if i have a perfectly written main method like this: public static void main(String...a).
I have already checked the classpath and every thing seems fine.
What could be the possible reason?
Please help me out.
Thanks....
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sudhanshu Mishra wrote:When i try to compile a code it does fine,but running a code by java command always gives the error that 'Main method not found.please declare it as pulic static void main(String[] args',even if i have a perfectly written main method like this: public static void main(String...a).


Please post the actual code, and how are you compiling and running it from terminal.
 
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sudhanshu Mishra wrote:Hi all,
I am facing a problem whose reason i am unable to understand.
I am running linux on my syatem,and java version 7.0.
When i try to compile a code it does fine,but running a code by java command always gives the error that 'Main method not found.please declare it as pulic static void main(String[] args',even if i have a perfectly written main method like this: public static void main(String...a).
I have already checked the classpath and every thing seems fine.
What could be the possible reason?
Please help me out.
Thanks....



Post your code then only may be we can figure it out.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a critical difference between String and String[]. If you don't declare the main method's one and only argument as String[], it won't look like a main method. Java finds methods using their signatures, which are strings of specially-coded text that contain the method name, the return type, and the types of all their parameter arguments, so if you use the wrong parameter type, the wrojng signature will be generated and Java won't find the method.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic