Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Eclipse JEE application

Reply
Thread Tools

Eclipse JEE application

 
 
Tim Slattery
Guest
Posts: n/a
 
      05-03-2011
I've been a Netbeans user, but the powers that be have dictated that I
have to use Eclipse.

I've created a JavaEE "Dynamic Web Project". I've imported my struts
jars by copying and pasting (but there must be a way to find them from
within Eclipse). Then I create a Java class. I can use the classes
defined in the Struts jars, no problem there. But I cannot use things
like HttpServletRequest, HttpServletResponse, or HttpSession. It
doesn't know what they are. If I manually write the "import"
statements, it tells me "the import cannot be resolved".

It knows that this is a Java EE app, so why in the world can't it
figure this stuff out?

--
Tim Slattery
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
 
 
 
Arved Sandstrom
Guest
Posts: n/a
 
      05-03-2011
On 11-05-03 01:34 PM, Tim Slattery wrote:
> I've been a Netbeans user, but the powers that be have dictated that I
> have to use Eclipse.
>
> I've created a JavaEE "Dynamic Web Project". I've imported my struts
> jars by copying and pasting (but there must be a way to find them from
> within Eclipse). Then I create a Java class. I can use the classes
> defined in the Struts jars, no problem there. But I cannot use things
> like HttpServletRequest, HttpServletResponse, or HttpSession. It
> doesn't know what they are. If I manually write the "import"
> statements, it tells me "the import cannot be resolved".
>
> It knows that this is a Java EE app, so why in the world can't it
> figure this stuff out?
>

For something as generic as the JAR for the Servlet API and
implementation, one usually sets up a runtime (Tomcat, JBoss, WebSphere,
Oracle oc4j etc) and those libraries are then available to you.

A right-click under the Servers tab to get New->Server will get you started.

AHS
 
Reply With Quote
 
 
 
 
markspace
Guest
Posts: n/a
 
      05-04-2011
On 5/3/2011 1:45 PM, Arved Sandstrom wrote:

> For something as generic as the JAR for the Servlet API and
> implementation, one usually sets up a runtime (Tomcat, JBoss, WebSphere,
> Oracle oc4j etc) and those libraries are then available to you.



At least in NetBeans, when you set up a type of "project," the base
libraries are put on your compile path. For example, when you choose
"Web Application," you don't have to do anything else to extend for
example HttpServlet.


> A right-click under the Servers tab to get New->Server will get you started.



If this is the answer, then it is indeed a bit weird for someone from a
NetBeans background. Hopefully, you're answering about the compile-time
environment and not the run-time.

(NetBeans comes with a server, Glassfish, by default if you get the
"full Monty" (<-- air quotes), so perhaps that is why you don't have to
explicitly install one in NB. It always has at least one server to
compile against.)
 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      05-04-2011
On 11-05-03 09:56 PM, markspace wrote:
> On 5/3/2011 1:45 PM, Arved Sandstrom wrote:
>
>> For something as generic as the JAR for the Servlet API and
>> implementation, one usually sets up a runtime (Tomcat, JBoss, WebSphere,
>> Oracle oc4j etc) and those libraries are then available to you.

>
>
> At least in NetBeans, when you set up a type of "project," the base
> libraries are put on your compile path. For example, when you choose
> "Web Application," you don't have to do anything else to extend for
> example HttpServlet.


I seem to remember that. I haven't used NetBeans for a couple of years,
and even then it was for a desktop app (a socket server actually). So
it's likely been 3 or 4 years since I fired up a web or full J2EE app on NB.

I do actually keep up with NetBeans dev. I have 6.9 and/or 7 installed
on two boxes right now, just in case. The reason I barely use it is
because no clients in the last 3 or 4 years have...it's almost always
Eclipse. I try to evangelize a bit but it's tough slogging.

>> A right-click under the Servers tab to get New->Server will get you
>> started.

>
>
> If this is the answer, then it is indeed a bit weird for someone from a
> NetBeans background. Hopefully, you're answering about the compile-time
> environment and not the run-time.


Well, compile time and run time, it's somewhat indistinguishable. If
you're writing J2EE/Java EE with a typical app server there's the
expectation that most of your core stack is going to be supplied by the
server, not by the WAR/JAR/EAR. So your compile time requirements for
core Java EE APIs, and for your JSF, and for your persistence, and so
forth, are supplied by the server libraries - otherwise you are
maintaining two sets of dependencies.

> (NetBeans comes with a server, Glassfish, by default if you get the
> "full Monty" (<-- air quotes), so perhaps that is why you don't have to
> explicitly install one in NB. It always has at least one server to
> compile against.)


That's the difference, and Glassfish (or specific variants thereof) is
the Java EE reference implementation besides. Eclipse (at least all the
versions I've used) has elected not to include a server, but it does
have an easy-to-use server plugin system that handles most of the app
servers out there - you yourself obtain and unpack the server distro,
and the Eclipse server plugin for server X simplifies the process of
making Eclipse aware of it. I can typically set up and configure Eclipse
for Tomcat or JBoss or oc4j or whatever inside 5 minutes, once the
server distro is unpacked.

I have no objections to either approach, NetBeans or Eclipse. The
Eclipse approach is more realistic for me, as no client my company has,
has had, or ever will have, uses or will use Glassfish. So it's best
for me to go through the initial upfront setup for OAS or Websphere or
JBoss first on any given project. YMMV.

AHS
--
Governor Thomas was so pleas'd with the Construction of this Stove, as
describ'd in it, that he offer'd to give me a Patent for the sole
Vending of them for a Term of Years; but I declin'd it from a Principle
which has ever weigh'd with me on such Occasions, viz. That as we enjoy
great Advantages from the Inventions of Others, we should be glad of an
Opportunity to serve others by any Invention of ours, and this we should
do freely and generously.
-- Benjamin Franklin

 
Reply With Quote
 
Tim Slattery
Guest
Posts: n/a
 
      05-04-2011
markspace <-@.> wrote:

>On 5/3/2011 1:45 PM, Arved Sandstrom wrote:
>
>> For something as generic as the JAR for the Servlet API and
>> implementation, one usually sets up a runtime (Tomcat, JBoss, WebSphere,
>> Oracle oc4j etc) and those libraries are then available to you.

>
>
>At least in NetBeans, when you set up a type of "project," the base
>libraries are put on your compile path. For example, when you choose
>"Web Application," you don't have to do anything else to extend for
>example HttpServlet.


Exactly right.
>
>
>> A right-click under the Servers tab to get New->Server will get you started.


Nogo. I had already done that, before posting. I'd downloaded support
for Weblogic (our server), I'd created a "server" within eclipse. No
change.

If I now bring up project options and choose "Servers", I get a page
that says "This project is not associated with any servers." The only
other thing on the page is a "Restore Defaults" button and an "Apply"
button. Not very helpful.

There's a pane at the bottom of the Eclipse windows that has four
tabs" Markers, Servers, Data Source Explorer, and Snippets. CLicking
the "Servers" tab shows the WL server that I created, and says
[Started].

--
Tim Slattery
(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-04-2011
On 05/04/2011 09:13 AM, Tim Slattery wrote:
> markspace<-@.> wrote:
>
>> On 5/3/2011 1:45 PM, Arved Sandstrom wrote:
>>
>>> For something as generic as the JAR for the Servlet API and
>>> implementation, one usually sets up a runtime (Tomcat, JBoss, WebSphere,
>>> Oracle oc4j etc) and those libraries are then available to you.

>>
>>
>> At least in NetBeans, when you set up a type of "project," the base
>> libraries are put on your compile path. For example, when you choose
>> "Web Application," you don't have to do anything else to extend for
>> example HttpServlet.

>
> Exactly right.
>>
>>
>>> A right-click under the Servers tab to get New->Server will get you started.

>
> Nogo. I had already done that, before posting. I'd downloaded support
> for Weblogic (our server), I'd created a "server" within eclipse. No
> change.
>
> If I now bring up project options and choose "Servers", I get a page
> that says "This project is not associated with any servers." The only
> other thing on the page is a "Restore Defaults" button and an "Apply"
> button. Not very helpful.
>
> There's a pane at the bottom of the Eclipse windows that has four
> tabs" Markers, Servers, Data Source Explorer, and Snippets. CLicking
> the "Servers" tab shows the WL server that I created, and says
> [Started].


You have to set up "runtimes". Context-menu the project, select "Properties"
and set up the "Targeted Runtimes".

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Eclipse, JEE, Hello World Arved Sandstrom Java 7 03-09-2009 10:51 AM
Re: Eclipse, JEE, Hello World Arne Vajhøj Java 3 03-07-2009 10:50 PM
Eclipse JEE 3.4 and JBoss 5 (Missing classpath entry) jonne Java 0 02-08-2009 06:53 PM
tomcat server error in eclipse-jee-europa david_marsetty Java 0 01-29-2008 05:13 AM
Problem with JEE 5 Sun Java System Application Server Naeem Java 1 04-14-2007 03:06 PM



Advertisments