Solved

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

Posted on 2004-04-06
11
135 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
  • 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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:mayankeagle
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:mayankeagle
ID: 10958610
Split: CEHJ and orangehead911
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now