Is there a way in eclipse to search the classpath for arbitrary resource file names (or patterns)?
I know I can use either
Navigate > Open Type
(which will scan the classpath for classes) or
Navigate > Open Resource,
which will search for any resource type, but only in my project folders. Is there any way to achieve a combination ob both, to do a resource search (something like *.xsd) that searches all jars on the classpath?
The classpath helper plugin is at least a starting point. Looks like it doesn't provide a search but it seems to list all entries on the classpath.
I don't know if your fit and willing to modify it but it should provide the basic code to add some filename-based search on top.
Which Version are you using?
Because when I open the search-menu (Java-Search), I could choose, which space should be searched, whether the hole workspace or including all JRE-Libraries. Think, it should work for you.
Related
I have been getting some problems with my application because of library I used to JAX-WS. I found one solution but I have to add a share library in WAS 8.5 and I don't know how can I do it.
I'll leave you the link of the documentation I'm following.
http://mail-archives.apache.org/mod_mbox/cxf-issues/201207.mbox/%3C310771353.90819.1343048795043.JavaMail.jiratomcat#issues-vm%3E
Here's the documentation for managing shared libraries: https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcws_sharedlib.html
That document is for 8.5.5, but the procedure is the same on 7.0-9.0.
Quick summary: In the admin console, go to the "Environment" section, then "Shared libraries", then create one, name it whatever you want, and set the class path to either the specific jar files you need or the directory containing them (note that if you specify a directory, it'll pull in all the jars in that directory by default). To use an isolated class loader, just check the "Use an isolated class loader" checkbox.
I develop a simple plugin for netbeans platform. I wonder how can i get a classpath of specify java project (for example i have opened two WebJavaProject) and now i dont know how can i get a classsLoader for specify project.
Im trying something like but this dosent work:
FileObject f = this.project.getProjectDirectory();
ClassPath cpCompile = ClassPath.getClassPath(f, ClassPath.COMPILE);
cpCompile.getClassLoader(true);
can any body know how can i get it?
You need to look for a more specific classpath. One project will usually contain classpath for sources and classpath for tests. If you start from a project you probably want to access its Sources or SourceGroups (check ProjectUtils.getSources(org.netbeans.api.project.Project) and JavaProjectConstants.SOURCES_TYPE_JAVA). This will give you source roots and there will be classpath associated with them.
Is there a way to create user library in eclipse using class path variable to add relative path jars to the library
It's easy. Don't use User Libraries. Instead, use Variables. Example from my workspace:
Open image in a new tab to see full size
Further reference: Here and there
The approach suggested by GGrec is functional and I used it. But "User Libraries" allow some sort of grouping/structuring, for example "Jersey", or "Hibernate", etc.
I found an alternative way to get it working: Created the simplest Eclipse Project. Then inside it created "Linked Resource" Folder using an Eclipse Path Variable. Now I can create the necessary "User Libraries" and "Add JARs" to them, using this Linked resource folder.
In case the location of the jars is changed, the only thing that should be altered is the Eclipse Path Variable, pointing to them.
May be this approach can help someone else.
we have downloaded jar files for lambdaj and its dependencies which are again jar files.
we do not know how to go about it. we have copied these files in the
C:\Program Files\Java\jre6\lib\ext
have set the class path in environment variales as:
variable: classpath
path: C:\Program Files\Java\jre6\lib\ext
but we do not know how to go further. we want to run some lambdaj programs.
can anyone suggest how to run lambdaj programs?
You would run a Java program that requires lambdaj in exactly the same way you'd run any other java program with an external dependency, i.e. by invoking the java executable passing in the fully-qualified name of the Main class, or the JAR with an appropriate manifest, or by deploying it in a servlet container, etc. Additionally you should be putting the LambdaJ JAR on the classpath for this invocation, not in the lib folder for your entire JVM.
What have you tried so far and why/how is it not working? Your question at the moment is a bit analogous to "I want to use Microsoft Word to view some Word documents, how do I do this?".
Update for comment 1: You said "it's not working". That doesn't help anyone address your problem as it gives no clue what you expected to happen and what you observed, only that they were different. As for where JAR files can be stored - you can put them in any directory, so long as that directory is on the classpath (or you add it to the classpath) of the Java application that runs. The canonical place to put external dependencies is in a folder called lib below the root of your project, but the important thing is that you choose somewhere consistent and sensible.
It sounds like you don't quite grok Java and classpaths yet. If you have followed some tutorials and are still stuck, ask for help to let you understand. Adding more detail to your question, including the layout of your files, the commands you issued, and the response that came back would be useful too.
If you are using Netbeans create a project and right click on the Libraries folder within the desired project. Click Add JAR/Folder...
Is there a way to get the directory of a project in Eclipse? We are writing a plugin that will allow the user to select files, and then run some processes on those files. I would ideally like to be able to get all the files with a certain extension, but that is not necessary.
sure:
ResourcesPlugin.getWorkspace().getRoot().getProjects()
will get you a list of all the projects in the workspace. you can easily iterate to find the one you want. At that point, you can look for certain files by extensions, etc.
If you want to enable your users to select files inside eclipse workspace with a certain extension, you can look at the class org.eclipse.ui.dialogs.ElementTreeSelectionDialog (org.eclipse.ui.dialogs plugin)as a start.
Then, to have an example on how to make it filter extensions, you can look at the class org.eclipse.jdt.internal.ui.viewsupport.FilteredElementTreeSelectionDialog (org.eclipse.jdt.ui plugin) to see how they do it and then reimplement the stuff.
This should give you a higher level of action than going threw files inside projects by hand and reimplement dialogs.