aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Problem with JBuilder 8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Problem with JBuilder 8" Watch "Problem with JBuilder 8" New topic
Author

Problem with JBuilder 8

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
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.


John Bonham was stronger, but Keith Moon was faster.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
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

Joined: Sep 23, 2002
Posts: 126
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
Sheriff

Joined: Dec 04, 2000
Posts: 6037
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

Joined: Sep 23, 2002
Posts: 126
Cheers
I'll check this out tomorrow.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Moving to the IDE forum.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126

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 ]
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
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.
John Hembree
hired gun
Ranch Hand

Joined: Mar 07, 2003
Posts: 250

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem with JBuilder 8
 
Similar Threads
Why tomcat act like it error?
package/import Statements in Kathy's book
Servlets (HelloWorld) & JBuilder
Head Firsts BeerSelect compilation problem
error: cannot be accessed from outside package