Solved

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

Posted on 2004-04-06
11
148 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

749 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