X-Received: by 10.224.55.200 with SMTP id v8mr13965601qag.7.1372676766923; Mon, 01 Jul 2013 04:06:06 -0700 (PDT) X-Received: by 10.50.108.47 with SMTP id hh15mr772985igb.12.1372676766841; Mon, 01 Jul 2013 04:06:06 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!j2no3157819qak.0!news-out.google.com!f7ni121qai.0!nntp.google.com!j2no3157818qak.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Mon, 1 Jul 2013 04:06:06 -0700 (PDT) In-Reply-To: <0e2ef0c0-5b87-453a-8710-8febce4e3600@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T NNTP-Posting-Host: 173.164.137.214 References: <1d9dd692-b4e9-4a38-8f2e-43e838075af2@googlegroups.com> <0e2ef0c0-5b87-453a-8710-8febce4e3600@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7ac06ff2-e5fe-49a1-8bfc-196998df422e@googlegroups.com> Subject: Re: Desktop application and web application Linking... From: Lew Injection-Date: Mon, 01 Jul 2013 11:06:06 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.java.programmer:24550 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 wi= ndow(desktop window not web). I want to do the same thing on click of a but= ton of jsp page. So I created a servlet(and jsp as well) and call that clas= s(which creates chart) but My servlet is not able to create object of that = class. It shows an exception of class not found. >=20 > please guide me. The more evidence you can examine, the better. It sounds like you have a bu= ild=20 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= =20 piece of hard evidence you did provide, "java.lang.ClassNotFoundException",= =20 is indicative. This hints that you did not build a WAR, and further that you are attemptin= g=20 to invoke Java code directly from a JSP, which is a big no-no in Java Web= =20 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=20 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= =20 new to a platform. This means asking the right questions, first of yourself= =20 and then of others.=20 Here's what you need to learn: - Using Expression Language (EL) and JSP tags=20 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 actua= lly=20 needing to write a custom tag. Good. It would have been more trouble than= =20 it's worth. Logic, OTOH, I can write in Java. Then you use EL to push and pull values= =20 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 yo= ur=20 "java.lang.ClassNotFoundException" would have been found.=20 Then you can thoroughly understand the WAR file, which is the Java Web ap= p=20 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 ser= ver. - The standard build process for Java Web apps. Your exception stems from not putting the class in the right place, asking= =20 for it from the wrong place, and not having thoroughly read the instruction= s=20 yet. That last becomes a lifelong habit. So many times I find the answers t= o=20 questions I have in fundamental documentation (i.e., tutorials) that I've= =20 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". --=20 Lew