• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with JBuilder 8

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folks, i've got a book on servlets, and thought that i'd try and run some of the examples in it.
Things is, I can't compile even the most simple servlet.
The problem lies in the use of the import statements, i'm sure of it.
If I type in the following:-

I get an error saying: "Test.java": Error #: 901 : package com.omh stated in source E:\Java\Sams_Learn_Java\Test.java does not match directory . at line 1, column 13"
What's going on??
All i did was type out the code from the book - and not even that seems to work!
If it helps, the package javax.servlet doesn't seem to exist in JBuilder 8, from what I can see from the autocomplete.
Any help would be greatly appreciated.
Cheers in advance.
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have JBuilder 8. It does include javax.servlet. My guess is there's a package error. Are you sure you want to write the Test class in com.sun? If so, is the file placed in the folder /com/sun ?
--Mark
 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mark Herschberg:
I have JBuilder 8. It does include javax.servlet. My guess is there's a package error. Are you sure you want to write the Test class in com.sun? If so, is the file placed in the folder /com/sun ?
--Mark




All i want to do is compile this stub of code, and the statements above it.
What do I have to do, to get it to work, then?
What would you do to get the code to compile??
"If so, is the file placed in the folder /com/sun ?" What file do i place in com/sun?
Should i place the test.java file in a folder called sun?? If so, where should this folder be on the hard disk???
Please help, as I am totally lost. And have spent too many hours breaking my thumbs, getting nowhere with it.
 
Mark Herschberg
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you familiar with packages in Java? Here are two references if you're not.
Creating and Using Packages
Java Package Tutorial
You just need to make sure that your java file is in the right folder. If you check your project properties you'll see some working directory set for your project. Under the folder JBuilder will create a src directory where your java files will go. The directory structure under there must reflect the package struture, e.g.
Working directory: C:/Old_D_Drive/Projects/HBS/JBuilderFiles/SimTrade
Package: com.hbs.simtrade.test
File location: C:\Old_D_Drive\Projects\HBS\JBuilderFiles\SimTrade\src\com\hbs\simtrade\test
You really should put your classes in com.sun, since Sun will put its classes there and you might get a conflict. Instead, you should create packages like com.myCompany.test
--Mark
 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers
I'll check this out tomorrow.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the IDE forum.
 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I installed JBuilder 9 to see if the problem could be rectified.
It couldn't.
Basically, the javax package exists, but javax.servlet is not in it, in either JBuilder 8 or 9 enterprise edition.
I have been reading up on it.
Don't I need to install a JSWDK, and point my JBuilder to this?
If so, can somebody please supply the EXACT link i need to download the jwsdk. I have been to the sun site, and the download section, but have then been going round in circles for hours, trying to find the jswdk download link.
[ August 30, 2003: Message edited by: Steve Jensen ]
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hate that JBuilder doesn't make the Servlet package available immediatly...
If you are running the professional edition of jbuilder, you can just go to "File", "new", choose "web", and choose "servlet".
If not, download the web development kit, and make it a library in JBuilder. Then add it to the "required libraries" for your project.
 
hired gun
Posts: 250
MS IE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a vanilla load of JBuilder9 and mine wouldn't let me do the file, new, web, servlet choice as you outlined. However I do have the J2EE SDK installed and registered in my classpath statement. JBuilder still wouldn't compile the code listed above. Finally I clicked on "Tools" and then "Configure JDK's". Then with the java version on my machine selected in the left pane, and the class tab selected in the right pane, I clicked on "add" and browsed to where my jar file is located (D:/j2sdkee1.4/lib/j2ee.jar), clicked OK and then I was able to compile the file. I also had to add the test file to a project in order to get it to compile for me. After that JBuilder created the necessary folders beneath the source file's location to locate the .class file. HTH.
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic