?
Solved

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

Posted on 2004-04-06
11
Medium Priority
?
157 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
DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

 
LVL 86

Accepted Solution

by:
CEHJ earned 400 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 400 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

762 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