Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > exception java.lang....

Reply
Thread Tools

exception java.lang....

 
 
Reddikishore
Guest
Posts: n/a
 
      02-27-2008
Helo sirs
i am getting exception :"java.langnosuchmethod:main"
when i run simple follwing program
class Helo
{
public static void main(String args[])
{
System.out.println("Hello");
}
}
i saved it in d:colon &
i compiled it d:\>javac Helo.java
D:\>java Helo
at this time i got this exception.in my system ihave
classpath&path.for this i used JDK1.6 used
please solve
 
Reply With Quote
 
 
 
 
Pushkaraj
Guest
Posts: n/a
 
      02-27-2008
Everything seems to be fine! you need to type/re-run properly.
 
Reply With Quote
 
 
 
 
GArlington
Guest
Posts: n/a
 
      02-27-2008
On Feb 27, 1:49 pm, Reddikishore <yourkish...@gmail.com> wrote:
> Helo sirs
> i am getting exception :"java.langnosuchmethod:main"


This is NOT what you are getting...
If there is a problem copy it as it is, DO NOT rephrase...

> when i run simple follwing program
> class Helo
> {
> public static void main(String args[])
> {
> System.out.println("Hello");
> }}
>
> i saved it in d:colon &
> i compiled it d:\>javac Helo.java
> D:\>java Helo
> at this time i got this exception.in my system ihave
> classpath&path.for this i used JDK1.6 used
> please solve


if java.lang.NoSuchMethodException is thrown that means JVM can not
find your class/method...
Check your class path...
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      02-27-2008
Reddikishore <yourkish...@gmail.com> wrote:
>> i [sic] am getting exception :"java.langnosuchmethod:main"


GArlington wrote:
> This is NOT what you are getting...
> If there is a problem copy it as it is, DO NOT rephrase...


Amen.

>> i saved it in d:colon &


In what directory did you place the source file? Because in your command lines:

>> i compiled it d:\>javac Helo.java
>> D:\>java Helo


you show no indication that you put the file in the "colon" directory.

>> at this time i got this exception.in my system ihave
>> classpath&path.for this i used JDK1.6 used
>> please solve


GArlington wrote:
> if java.lang.NoSuchMethodException is thrown that means JVM can not
> find your class/method...
> Check your class path...


Also, list your working directory (D:\ in the example you gave) to make sure
the .java and .class files that you expect actually are there.

The default classpath absent explicit specification is '.', the current
working directory. Your commands should have worked, if the .java and .class
files were in the correct directory.

For future reference, don't use the root directory of a drive as your working
directory.

--
Lew
 
Reply With Quote
 
Sreenivas
Guest
Posts: n/a
 
      02-28-2008
On Feb 27, 6:49 pm, Reddikishore <yourkish...@gmail.com> wrote:
> Helo sirs
> i am getting exception :"java.langnosuchmethod:main"
> when i run simple follwing program
> class Helo
> {
> public static void main(String args[])
> {
> System.out.println("Hello");
> }}
>
> i saved it in d:colon &
> i compiled it d:\>javac Helo.java
> D:\>java Helo
> at this time i got this exception.in my system ihave
> classpath&path.for this i used JDK1.6 used
> please solve


As far as i know,this exception occurs in two ways.The first one is if
you doesn't set CLASSPATH environment variable.
second one is if you doesn't write the main method signature as
main(String [] args) or main(String args [])or main(String...args)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Throw Exception Vs Throw New Exception Kerri ASP .Net 2 10-27-2003 02:13 PM
Re: bizaar exception that isn't really an exception jeff ASP .Net 3 06-26-2003 01:02 PM
Re: bizaar exception that isn't really an exception jeff ASP .Net 0 06-24-2003 12:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57