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


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

Desktop application and web application Linking...

Started byRobin Saini <2robinsaini@gmail.com>
First post2013-06-30 22:19 -0700
Last post2013-07-04 21:46 -0400
Articles 5 — 4 participants

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


Contents

  Desktop application and web application Linking... Robin Saini <2robinsaini@gmail.com> - 2013-06-30 22:19 -0700
    Re: Desktop application and web application Linking... Robert Klemme <shortcutter@googlemail.com> - 2013-07-01 08:10 +0200
    Re: Desktop application and web application Linking... Robin Saini <2robinsaini@gmail.com> - 2013-07-01 00:58 -0700
      Re: Desktop application and web application Linking... Lew <lewbloch@gmail.com> - 2013-07-01 04:06 -0700
      Re: Desktop application and web application Linking... Arne Vajhøj <arne@vajhoej.dk> - 2013-07-04 21:46 -0400

#24542 — Desktop application and web application Linking...

FromRobin Saini <2robinsaini@gmail.com>
Date2013-06-30 22:19 -0700
SubjectDesktop application and web application Linking...
Message-ID<1d9dd692-b4e9-4a38-8f2e-43e838075af2@googlegroups.com>
Hello everyone,
Can I create an object of Desktop application class into a web application class? as I am facing a problem "java.lang.ClassNotFoundException" doing same.

[toc] | [next] | [standalone]


#24545

FromRobert Klemme <shortcutter@googlemail.com>
Date2013-07-01 08:10 +0200
Message-ID<b3ckqsFe9hrU1@mid.individual.net>
In reply to#24542
On 01.07.2013 07:19, Robin Saini wrote:
> Hello everyone, Can I create an object of Desktop application class
> into a web application class?

What is "create an object ... into" supposed to mean?  Are you talking 
about casting one to the other?  Are you trying to create the latter and 
pass the former to the constructor?  What classes are we talking about 
here at all?

> as I am facing a problem
> "java.lang.ClassNotFoundException" doing same.

What exactly are you doing?

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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


#24547

FromRobin Saini <2robinsaini@gmail.com>
Date2013-07-01 00:58 -0700
Message-ID<0e2ef0c0-5b87-453a-8710-8febce4e3600@googlegroups.com>
In reply to#24542
Thanks for Reply.
I have a method that creates a bar chart of some hard-code data(in array). I can call this method in Main method and it shows me the chart in new window(desktop window not web). I want to do the same thing on click of a button of jsp page. So I created a servlet(and jsp as well) and call that class(which creates chart) but My servlet is not able to create object of that class. It shows an exception of class not found.

please guide me.
--Thanks
Robin

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


#24550

FromLew <lewbloch@gmail.com>
Date2013-07-01 04:06 -0700
Message-ID<7ac06ff2-e5fe-49a1-8bfc-196998df422e@googlegroups.com>
In reply to#24547
Robin Saini wrote:
> I have a method that creates a bar chart of some hard-code data(in array). I can call this method in Main method and it shows me the chart in new window(desktop window not web). I want to do the same thing on click of a button of jsp page. So I created a servlet(and jsp as well) and call that class(which creates chart) but My servlet is not able to create object of that class. It shows an exception of class not found.
> 
> please guide me.

The more evidence you can examine, the better. It sounds like you have a build 
problem, that is to say, you need to examine how you build your web app.

You haven't given us much evidence, just a vague description, but the one 
piece of hard evidence you did provide, "java.lang.ClassNotFoundException", 
is indicative.

This hints that you did not build a WAR, and further that you are attempting 
to invoke Java code directly from a JSP, which is a big no-no in Java Web 
apps. That's even if you are using correct syntax, let alone modern syntax.

So the bad news is, absent contrary evidence, you have a lot of mistakes 
in your application, some fatal and some more slowly so.

Which is normal, especially as one is learning. And then forever after that.

The tricky part is figuring out what you did wrong, especially when you are 
new to a platform. This means asking the right questions, first of yourself 
and then of others. 

Here's what you need to learn:
- Using Expression Language (EL) and JSP tags 
  to eliminate the appearance of Java code in your JSP pages.
  Most of the tags you need should exist already. I can't recall ever actually 
  needing to write a custom tag. Good. It would have been more trouble than 
  it's worth.

  Logic, OTOH, I can write in Java. Then you use EL to push and pull values 
  to the display.

  Logic, of the model kind, does not belong in the presentation layer, the JSP.
  Look up "Model-View-Controller (MVC)".

- How to build a Java package, properly.
  This begins with thoroughly understanding the JAR file, which is where your 
  "java.lang.ClassNotFoundException" would have been found. 

  Then you can thoroughly understand the WAR file, which is the Java Web app 
  supersized JAR file, which in turn is Java's megawatt ZIP file.

  Then you can read how to deploy a WAR to Tomcat or other favorite app server.

- The standard build process for Java Web apps.

Your exception stems from not putting the class in the right place, asking 
for it from the wrong place, and not having thoroughly read the instructions 
yet. That last becomes a lifelong habit. So many times I find the answers to 
questions I have in fundamental documentation (i.e., tutorials) that I've 
actually read. Many times. And needed to read again.

Besides, a lot of documentation is fun, like "What Every Computer Scientist Should Know About Floating-Point Arithmetic".

-- 
Lew

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


#24638

FromArne Vajhøj <arne@vajhoej.dk>
Date2013-07-04 21:46 -0400
Message-ID<51d62571$0$294$14726298@news.sunsite.dk>
In reply to#24547
On 7/1/2013 3:58 AM, Robin Saini wrote:
> Thanks for Reply. I have a method that creates a bar chart of some
> hard-code data(in array). I can call this method in Main method and
> it shows me the chart in new window(desktop window not web). I want
> to do the same thing on click of a button of jsp page. So I created a
> servlet(and jsp as well) and call that class(which creates chart) but
> My servlet is not able to create object of that class. It shows an
> exception of class not found.

Can we get the full exception text and the full stack trace and
some code snippets around the location of the problem?

That may give us an indication of where the problem exist.

Arne

[toc] | [prev] | [standalone]


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


csiph-web