Solved

Compiling a java servlet at dos prompt that uses a precompiled class

Posted on 2004-04-06
11
154 Views
Last Modified: 2013-11-24
Hi there, im creating an online shop. I have made a product class (product bean) that is instanced every time the user wants to add a product to their cart. I have created a ShoppingServlet that handles the add, delete, view cart etc business logic therefore i use the product class in this servlet.  Eventhough the Product class is in the same directory as the ShoppingServlet the compiler does not resolve the symbol Product in (Product p = ...).

I have tried using a package, including it in the classpath but still no luck.  I must have a config prob somewhere but iv checked couple of times.

May be u can help me?
0
Comment
Question by:puntee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10768356
Is either of the classes in a package? Make sure there are no conflicts with other Product that could be in the classpath
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 10768436
Did you use an IDE to create the Java files?
0
 

Author Comment

by:puntee
ID: 10768732
yeah i used an ide
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 86

Accepted Solution

by:
CEHJ earned 100 total points
ID: 10768780
Then make sure Product is added to the project or whatever your IDE calls it (probably through the menu)
0
 
LVL 14

Assisted Solution

by:Tommy Braas
Tommy Braas earned 100 total points
ID: 10768917
Thanks for the abundance of information in your response.

Look at the classpath used for the compiler in your IDE, as I am assuming that compilation works fine there. Also, there might be console output from the IDE that tells you exactly how your Java files were compiled.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10768968
>>Look at the classpath used for the compiler in your IDE

Oh yes - i forgot - you're going from IDE to command line. That's absolutely right. IDEs tend to build their own, often sizeable, classpaths
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10772026
Yeah, if you're compiling from the command-prompt, you should see that the classes are there in the class-path of your system (because IDEs don't use system-classpath).

You can set the class-path this way: set classpath=%classpath%;c:\myfolder\....;.

// c:\myfolder\.... -> contains the .class files that you need

-> if you have the classes in a package, then set the classpath only till the parent directory of the package-folder

More on classpath: http://www.mindprod.com/jgloss/classpath.html

Which IDE are you using, BTW?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10958610
Split: CEHJ and orangehead911
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question