Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 2nd, 2008, 12:27 AM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in calling classes in simple Servlet

Hello all

Kindly help me to figure what the mistake i am making while calling the simple class file in a servlet.

i have written a simple servlet and name it as Eemlogin.java
 i am trying to call a class which i have in other notepade and saved it as LoginEemCompare.java . i have complied LoginEemCompare.java and after complilation i see class file of it.
In Servlet Eemlogin i have used below command to call the class.

LoginEemCompare lc=new LoginEemCompare();
but it gives me error cannot resolve symbol.Below is the error


C:\bea\nidhi\user_projects\nidhidomain\application s\DefaultWebApp\WEB-INF\classe
s>javac Eemlogin.java
Eemlogin.java:62: cannot resolve symbol
symbol : class LoginEemCompare
location: class Eemlogin
LoginEemCompare lc=new LoginEemCompare();
^
Eemlogin.java:62: cannot resolve symbol
symbol : class LoginEemCompare
location: class Eemlogin
LoginEemCompare lc=new LoginEemCompare();
                       ^
2 errors

i have stored both servlet(Eemlogin.java) and LoginEemCompare.java in the same folder and i am trying to run it in weblogic.
can anyone suggest what is the mistake that i might be making to get above error.if you want i can also send the code.

thanks in advance for your time .
nidhi

Reply With Quote
  #2 (permalink)  
Old February 2nd, 2008, 02:37 AM
jomet
Guest
 
Posts: n/a
Default

Hi,

use
javac -cp . *.java
(this is another way to tell the files are in current dir)

Cheers,

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.
Reply With Quote
  #3 (permalink)  
Old February 6th, 2008, 02:01 AM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello jomet

thankyou for your suggestion . i tried the command given by you but it is still giving me the same error . even tried to make some changes in my classpath from
C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;

to this
C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;C:\bea\nidhi\user_proj ects\nidhidomain\applications\DefaultWebApp\WEB-INF\classes;

but nothing is working for me . Can you suggest me something else.

thankyou in advance for your time

nidhi

Reply With Quote
  #4 (permalink)  
Old February 6th, 2008, 05:16 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello all

My problem is solved now . i changed claspath from

C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;

to
C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;C:\bea\nidhi\user_proj ects\nidhidomain\applications\DefaultWebApp\WEB-INF\classes;

and it works now for me . yesterday accidently i had not opened new cmd so it did not work and today i tried it again and now it works.
hope this helps someone else if they face same problem . i never used to make changes in Classpath for weblogic but seems sometimes we need to give full path where we keep the java files .

thanks
nidhi

Reply With Quote
  #5 (permalink)  
Old February 7th, 2008, 11:27 PM
jomet
Guest
 
Posts: n/a
Default

Hi,

Glad to know u solved it.
path changes will take effect when we open the cmd window.

Cheers,

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.
Reply With Quote
  #6 (permalink)  
Old July 11th, 2012, 11:44 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in calling classes in simple Servlet

Hello Jomet,

I am facing the same problem. And also tried both ways but i am not successfull. I don't know why??

I have one servlet (Register.java)
and a java class(Function.java)

First I compiled Function.java successfully but
When i compiling Register.java its giving me error Function class not found

In both way :-

1. javac -cp . *.java or javac -classpath . *.java

2. copying the class path where my from my tomcat path like:-

C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 7.0.22\webapps\loginnapp\WEB-INF\classes

but in both cases i am getting a common error:-

import javax.servlet.*;
^
Register.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Register.java:5: package javax.servlet does not exist
import javax.servlet.*;
^
Register.java:8: cannot find symbol
symbol: class HttpServlet
public class Register extends HttpServlet
^
Register.java:10: cannot find symbol
symbol : class HttpServletRequest
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException
^
Register.java:10: cannot find symbol
symbol : class HttpServletResponse
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException
^
Register.java:10: cannot find symbol
symbol : class ServletException
location: class Register
public void doGet(HttpServletRequest req, HttpServletResponse res) throw
s IOException, ServletException

^
Register.java:28: cannot access Functions
bad class file: .\Functions.class
class file contains wrong class: classes.Functions
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Functions fe=new Functions();
^
8 errors


please help me friends i m stuck
Reply With Quote
  #7 (permalink)  
Old December 23rd, 2012, 01:06 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Yes its working!

Hi Nidhi,
Thanks a lot for your suggestion. I did the same changes in my classpath and it worked for me too!
Thanks for it!

Quote:
Originally Posted by sanna231 View Post
hello all

My problem is solved now . i changed claspath from

C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;

to
C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Java\jre1.6.0_01\lib.;C:\bea\nidhi\user_proj ects\nidhidomain\applications\DefaultWebApp\WEB-INF\classes;

and it works now for me . yesterday accidently i had not opened new cmd so it did not work and today i tried it again and now it works.
hope this helps someone else if they face same problem . i never used to make changes in Classpath for weblogic but seems sometimes we need to give full path where we keep the java files .

thanks
nidhi
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling java Servlet from ascx page pradeepnair74 BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 October 7th, 2008 07:31 AM
calling a servlet by clicking a menu? pandian Servlets 1 February 4th, 2006 10:28 AM
Calling a command from a servlet emirant1 Servlets 1 December 23rd, 2005 11:33 AM
Calling external classes and/or subs/funcs jmischo VBScript 2 December 16th, 2004 08:45 AM
calling java servlet from javascript bearfacts Javascript How-To 1 August 26th, 2004 04:57 PM



All times are GMT -4. The time now is 06:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.