Solved

How do I add javax.jws.WebMethod to my Java project?

Posted on 2014-02-01
3
2,448 Views
Last Modified: 2014-02-21
I am new to Java and am trying to work through a webservice tutorial.  The tutorial instructs me to "import" javax.jws.WebMethod.  I have done so at the top of my java class file but notes...

"Access restriction: The type WebMethod is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar"
0
Comment
Question by:Bruce
3 Comments
 
LVL 1

Author Comment

by:Bruce
Comment Utility
Also, javax.jws.WebMethod does not appear in the rt.jar in the package explorer tree.  Should it?

Can I somehow add this to rt.jar?

Sorry, I am really really new to this...
0
 
LVL 35

Accepted Solution

by:
mccarl earned 250 total points
Comment Utility
Do you have other libraries included in your project? One of these may also be providing the WebMethod annotation. I assume you are using Eclipse, if so you can check by pressing Ctrl + Shift + T  (or whatever your shortcut for "Open Type..." is) and then type WebMethod into the input text box. It should list all the libraries that it can see that annotation in.

Also, javax.jws.WebMethod does not appear in the rt.jar in the package explorer tree.  Should it?
Yes it should. And no you can't just add it somehow. I actually doubt that it isn't there. Do you at least have the "javax.jws" package? Can you send a screenshot of what you are looking at and where you expect to see it?
0
 
LVL 6

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 250 total points
Comment Utility
You are using JAX-WS webservices.  
You may refer,  https://javaee-spec.java.net/nonav/javadocs/index.html?javax/jws/WebMethod.html

You can download jws-api.jar as well.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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 about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now