Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Desktop application and web application Linking...

Reply
Thread Tools

Desktop application and web application Linking...

 
 
Robin Saini
Guest
Posts: n/a
 
      07-01-2013
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.
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      07-01-2013
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/
 
Reply With Quote
 
 
 
 
Robin Saini
Guest
Posts: n/a
 
      07-01-2013
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
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      07-01-2013
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 ScientistShould Know About Floating-Point Arithmetic".

--
Lew
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      07-05-2013
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

 
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
Desktop accesses laptop and reads folders but Laptop only accesses/opens Desktop but cannot read folders, access is denied onclejon Wireless Networking 3 11-01-2006 10:50 PM
Same Application with Web and Desktop Application Interface ASP .Net Security 2 10-19-2005 05:19 PM
Can't access laptop from desktop, but can access desktop from lapt =?Utf-8?B?Y2FydG1hbg==?= Wireless Networking 2 08-06-2005 01:08 AM
Desktop can't access Laptop but Laptop can access desktop =?Utf-8?B?Qmx1Y2FkZHk3MQ==?= Wireless Networking 2 11-23-2004 01:52 AM
Difference between Remote Desktop and Remote Desktop for Admin Dave Marden MCSE 16 01-24-2004 12:47 PM



Advertisments