Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #13463 > unrolled thread

Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC

Started bydeepak <deepak.vaswani@gmail.com>
First post2012-04-10 01:40 -0700
Last post2012-04-13 10:24 -0700
Articles 11 — 6 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC deepak <deepak.vaswani@gmail.com> - 2012-04-10 01:40 -0700
    Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC GGolf <invalid@invalid.com> - 2012-04-10 18:56 +0530
      Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Lew <lewbloch@gmail.com> - 2012-04-10 10:16 -0700
      Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Roedy Green <see_website@mindprod.com.invalid> - 2012-04-29 07:52 -0700
    Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC deepak <deepak.vaswani@gmail.com> - 2012-04-11 04:19 -0700
      Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Paul Cager <paul.cager@googlemail.com> - 2012-04-11 05:44 -0700
        Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Lew <noone@lewscanon.com> - 2012-04-11 08:11 -0700
        Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC GGolf <invalid@invalid.com> - 2012-04-12 07:38 +0530
          Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Lew <lewbloch@gmail.com> - 2012-04-12 10:47 -0700
    Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC deepak <deepak.vaswani@gmail.com> - 2012-04-13 07:45 -0700
      Re: Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC Lew <lewbloch@gmail.com> - 2012-04-13 10:24 -0700

#13463 — Exception in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC

Fromdeepak <deepak.vaswani@gmail.com>
Date2012-04-10 01:40 -0700
SubjectException in thread "main" java.lang.NoClassDefFoundError: SendMailTLSDFC
Message-ID<cc382f4c-8985-491e-ac7e-f4c71e07bd71@9g2000yqp.googlegroups.com>
Hi, I have created a java file for sending a file to my mail. I am
using mail.jar file. I am able to create .class file properly. But am
unable to run this file using java command on command prompt.
 javac -cp D:\mail.jar SendMailTLSDFC.java
above command is working properly.
It creates 2 class as mentioned below
SendMailTLSDFC$1.class
SendMailTLSDFC.class

but when i am trying to run following command I am getting an error.
java -cp D:\mail.jar SendMailTLSDFC
Exception in thread "main" java.lang.NoClassDefFoundError:
SendMailTLSDFC

Kindly help

[toc] | [next] | [standalone]


#13465

FromGGolf <invalid@invalid.com>
Date2012-04-10 18:56 +0530
Message-ID<jm1cen$41b$1@speranza.aioe.org>
In reply to#13463
On 04/10/2012 02:10 PM, deepak wrote:
> Hi, I have created a java file for sending a file to my mail. I am
> using mail.jar file. I am able to create .class file properly. But am
> unable to run this file using java command on command prompt.
>   javac -cp D:\mail.jar SendMailTLSDFC.java
> above command is working properly.
> It creates 2 class as mentioned below
> SendMailTLSDFC$1.class
> SendMailTLSDFC.class
>
> but when i am trying to run following command I am getting an error.
> java -cp D:\mail.jar SendMailTLSDFC
> Exception in thread "main" java.lang.NoClassDefFoundError:
> SendMailTLSDFC

Did you try adding the current folder (.) to the classpath?

[toc] | [prev] | [next] | [standalone]


#13466

FromLew <lewbloch@gmail.com>
Date2012-04-10 10:16 -0700
Message-ID<23393087.261.1334078197190.JavaMail.geo-discussion-forums@pbjk8>
In reply to#13465
GGolf wrote:
> deepak wrote:
> > Hi, I have created a java [sic] file for sending a file to my mail. I am
> > using mail.jar file. I am able to create .class file properly. But am
> > unable to run this file using java command on command prompt.
> >   javac -cp D:\mail.jar SendMailTLSDFC.java
> > above command is working properly.
> > It creates 2 class as mentioned below
> > SendMailTLSDFC$1.class
> > SendMailTLSDFC.class
> >
> > but when i am trying to run following command I am getting an error.
> > java -cp D:\mail.jar SendMailTLSDFC
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > SendMailTLSDFC
> 
> Did you try adding the current folder (.) to the classpath?

In addition to GGolf's fine advice, which should solve that immediate problem, let me add a couple of extras:

- http://sscce.org/
This fine discussion of the Simple, Self-Contained Compilable (Correct) Example (SSCCE) by Andrew Thompson will help you two ways. Creating an example often reveals the problem to you before you post your question, and the example isolates your issue and makes it easier for people to respond sensibly. GGolf was clever to figure out your issue without an SSCCE.

- Use packages.
You put 'SendMailTLSDFC' in the default package, or "no-package" package. Don't do that.

Also, study the Java tutorial and other documentation on classpaths.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#14030

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-04-29 07:52 -0700
Message-ID<b9lqp7hcb0fl9v8v8q8p14vt1kqs8fdk65@4ax.com>
In reply to#13465
On Tue, 10 Apr 2012 18:56:50 +0530, GGolf <invalid@invalid.com> wrote,
quoted or indirectly quoted someone who said :

>NoClassDefFoundError

see
http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML. 
They forget that the simplest language is the one you 
already know. They also forget that their simple little 
markup language will bit by bit become even more convoluted 
and complicated than HTML because of the unplanned way it grows.
.

[toc] | [prev] | [next] | [standalone]


#13468

Fromdeepak <deepak.vaswani@gmail.com>
Date2012-04-11 04:19 -0700
Message-ID<5669729.293.1334143190239.JavaMail.geo-discussion-forums@pbtr10>
In reply to#13463


On Tuesday, April 10, 2012 2:10:43 PM UTC+5:30, deepak wrote:
> Hi, I have created a java file for sending a file to my mail. I am
> using mail.jar file. I am able to create .class file properly. But am
> unable to run this file using java command on command prompt.
>  javac -cp D:\mail.jar SendMailTLSDFC.java
> above command is working properly.
> It creates 2 class as mentioned below
> SendMailTLSDFC$1.class
> SendMailTLSDFC.class
> 
> but when i am trying to run following command I am getting an error.
> java -cp D:\mail.jar SendMailTLSDFC
> Exception in thread "main" java.lang.NoClassDefFoundError:
> SendMailTLSDFC
> 
> Kindly help


Hi,
Thanks so much for your reply GGolf and Lew.
GGolf, I tried . also and I got the result as shown below.
D:\project>java . SendMailTLSDFC
Exception in thread "main" java.lang.NoClassDefFoundError: /

Lew,
I had used packages but i just removed it from the current file before posting the question here just reduce the complexities. 

Kindly help

[toc] | [prev] | [next] | [standalone]


#13470

FromPaul Cager <paul.cager@googlemail.com>
Date2012-04-11 05:44 -0700
Message-ID<b1d3ae88-4c36-45d0-b7ae-eccf0c8b2aef@db5g2000vbb.googlegroups.com>
In reply to#13468
On Apr 11, 12:19 pm, deepak <deepak.vasw...@gmail.com> wrote:
> I tried . also and I got the result as shown below.
> D:\project>java . SendMailTLSDFC
> Exception in thread "main" java.lang.NoClassDefFoundError: /

You need

  java -cp . SendMailTLSDFC

Otherwise the java command assumes "." is the name of the class you
are trying to run.

[toc] | [prev] | [next] | [standalone]


#13479

FromLew <noone@lewscanon.com>
Date2012-04-11 08:11 -0700
Message-ID<jm46ub$8v6$1@news.albasani.net>
In reply to#13470
Paul Cager wrote:
> deepak wrote:
>> I tried . also and I got the result as shown below.
>> D:\project>java . SendMailTLSDFC
>> Exception in thread "main" java.lang.NoClassDefFoundError: /
>
> You need
>
>    java -cp . SendMailTLSDFC
>
> Otherwise the java command assumes "." is the name of the class you
> are trying to run.

Deepak, you should read the documentation on the "javac" and "java" commands.

Randomly tossing strings into your command isn't nearly as effective as 
looking up the correct syntax and using it.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

[toc] | [prev] | [next] | [standalone]


#13489

FromGGolf <invalid@invalid.com>
Date2012-04-12 07:38 +0530
Message-ID<jm5deq$59h$1@speranza.aioe.org>
In reply to#13470
On 04/11/2012 06:14 PM, Paul Cager wrote:
> On Apr 11, 12:19 pm, deepak<deepak.vasw...@gmail.com>  wrote:
>> I tried . also and I got the result as shown below.
>> D:\project>java . SendMailTLSDFC
>> Exception in thread "main" java.lang.NoClassDefFoundError: /
>
> You need
>
>    java -cp . SendMailTLSDFC
>
> Otherwise the java command assumes "." is the name of the class you
> are trying to run.

To the OP: You'll need mail.jar on the classpath too, so the command 
will be:

java -cp D:\mail.jar;. SendMailTLSDFC

[toc] | [prev] | [next] | [standalone]


#13502

FromLew <lewbloch@gmail.com>
Date2012-04-12 10:47 -0700
Message-ID<2761302.422.1334252821970.JavaMail.geo-discussion-forums@pbje9>
In reply to#13489
GGolf wrote:
> Paul Cager wrote:
>> deepak wrote:
>>> I tried . also and I got the result as shown below.
>>> D:\project>java . SendMailTLSDFC
>>> Exception in thread "main" java.lang.NoClassDefFoundError: /
>>
>> You need
>>
>>    java -cp . SendMailTLSDFC
>>
>> Otherwise the java command assumes "." is the name of the class you
>> are trying to run.
> 
> To the OP: You'll need mail.jar on the classpath too, so the command 
> will be:
> 
> java -cp D:\mail.jar;. SendMailTLSDFC

<http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html>

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#13522

Fromdeepak <deepak.vaswani@gmail.com>
Date2012-04-13 07:45 -0700
Message-ID<7597456.21.1334328327685.JavaMail.geo-discussion-forums@pbvs10>
In reply to#13463
Thanks a lot evrybody,
java -cp D:\mail.jar;. SendMailTLSDFC 
Above command worked. 

Deepak
:)


On Tuesday, April 10, 2012 2:10:43 PM UTC+5:30, deepak wrote:
> Hi, I have created a java file for sending a file to my mail. I am
> using mail.jar file. I am able to create .class file properly. But am
> unable to run this file using java command on command prompt.
>  javac -cp D:\mail.jar SendMailTLSDFC.java
> above command is working properly.
> It creates 2 class as mentioned below
> SendMailTLSDFC$1.class
> SendMailTLSDFC.class
> 
> but when i am trying to run following command I am getting an error.
> java -cp D:\mail.jar SendMailTLSDFC
> Exception in thread "main" java.lang.NoClassDefFoundError:
> SendMailTLSDFC
> 
> Kindly help

[toc] | [prev] | [next] | [standalone]


#13528

FromLew <lewbloch@gmail.com>
Date2012-04-13 10:24 -0700
Message-ID<2521187.69.1334337843134.JavaMail.geo-discussion-forums@pbckz3>
In reply to#13522
deepak wrote:
> Thanks a lot evrybody,
> java -cp D:\mail.jar;. SendMailTLSDFC 
> Above command worked. 

Thank you very much for showing us what worked.

(P.S. - Please do not top-post.)

-- 
Lew

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web