Setting up Bundle-RequiredExecutionEnvironment causes access restriction errors [message #336139] |
Tue, 26 May 2009 06:50  |
Eclipse User |
|
|
|
I recently upgraded to eclipse 3.4 for my RCP application development
work. I decided to clean up my "No required execution environment has
been set" warnings. After adding the line
"Bundle-RequiredExecutionEnvironment: JavaSE-1.6" to all my plug-ins'
manefest files everything was OK except for one plug-in where I do some
XML manipulation using SAX2DOM and XPathAPI. In that class I get a bunch
of errors like this:
Access restriction: The constructor SAX2DOM() is not accessible due to
restriction on required library C:\Program
Files\Java\jdk1.6.0_13\jre\lib\rt.jar ReadClipboard.java com.lesliesoftware.wizardsfamiliar.deck.editor/src/com/lesli esoftware/wizardsfamiliar/deck/editor/clipboard line
230 Java Problem
When I edit the JRE System Library settings in the Project Properties |
Java Build Path | Libraries if I choose "Execution Environment JavaSE-1.6
(jdk1.6.0_13)" I get the compile errors. If I choose "Workspace default
JRE (jdk1.6.0_13)" the code compiles but I get an "The JRE container on
the classpath is not a perfect match to the 'JavaSE-1.6'" warning in my
mf file instead of the "No required execution environment has been set"
warning I am trying to fix.
Clearly my 1.6 JDK is a perfect match for the JavaSE-1.6 environment and
the preference page Java | Installed JREs | Execution Environment even
says as much. What is wrong with how I am trying to fix this?
Any help would be appreciated.
Ian
Code (I am using TagSoup to parse the HTML contents from the clip board
and then XPath to find content in the HTML to create my elements from):
---8<---
private void createSlotsFromHTMLTransfer (String contents) {
StringReader inputReader = null;
try {
// Create and configure the parser
Parser parser = new Parser ();
parser.setFeature
("http://xml.org/sax/features/namespace-prefixes", true); //$NON-NLS-1$
// Parse the HTML
SAX2DOM sax2dom = new SAX2DOM ();
parser.setContentHandler (sax2dom);
inputReader = new StringReader (contents);
InputSource inputSource = new InputSource (inputReader);
inputSource.setEncoding ("UTF-8"); //$NON-NLS-1$
parser.parse (inputSource);
Node doc = sax2dom.getDOM ();
if (TraceUtil.isOptionEnabled
(DebugOptions.CLIPBOARD_SAVEXML)) {
try {
// Prepare the DOM document for writing
Source source = new DOMSource(doc);
// Prepare the output file
File file = File.createTempFile ("clipboard", ".xml");
//$NON-NLS-1$ //$NON-NLS-2$
Result result = new StreamResult(file);
// Write the DOM document to the file
Transformer xformer =
TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
TraceUtil.trace (DebugOptions.CLIPBOARD_SAVEXML,
"Clipboard contents saved to: " +
file.getAbsolutePath ()); //$NON-NLS-1$
} catch (TransformerConfigurationException e) {
TraceUtil.trace (DebugOptions.CLIPBOARD_SAVEXML,
e.getMessageAndLocation ());
} catch (TransformerException e) {
TraceUtil.trace (DebugOptions.CLIPBOARD_SAVEXML,
e.getMessageAndLocation ());
}
}
resetCurrentLine ();
String topLevelParents = "/html:html/html:body"; //$NON-NLS-1$
NodeList topLevelNodes = XPathAPI.selectNodeList (doc,
topLevelParents);
for (int index = 0; index < topLevelNodes.getLength ();
index++) {
Node curNode = topLevelNodes.item (index);
processContainingNode (curNode);
}
} catch (Exception exception) {
// Any exception indicates invalid data
EditorPlugin.getDefault ().getLog ().log
(DeckEditorError.clipboardFormatError (exception));
DND.error (DND.ERROR_INVALID_DATA);
mySlots = null;
} finally {
if (inputReader != null)
inputReader.close ();
}
}
--->8---
|
|
|
|
|
Re: (SOLVED - mostly) Re: Setting up Bundle-RequiredExecutionEnvironment causes... [message #336210 is a reply to message #336198] |
Fri, 29 May 2009 10:42  |
Eclipse User |
|
|
|
Yes, I can see that - makes seance. I did not notice that distinction in
the UI at the point were you choose the radio button between the default
JRE and the execution environment. But there is little point in
complaining about that. If I am setting up a specific execution
environment I should be well aware of that difference. In this case I
just was not:-)
Ian
Walter Harley wrote:
> "Ian Leslie" <ian.leslie@lesliesoftware.com> wrote in message
> I think that if you point to a JRE it'll take
> whatever is in there, whereas if you specify an operating environment it
> forces you to comply to the minimum definition of that environment, which
> may not include all the libraries that are physically present.
|
|
|
Powered by
FUDForum. Page generated in 0.03709 seconds