classpath

Can I prevent javac accessing the Class-Path from the manifests of our third party jars?

Since Java 1.5 or so, javac has been looking into the manifest of third-party jars to find other jars. This causes a number of undesirable side-effects: As jar files have been renamed, we now get a flood of warnings whenever we compile (can be diabled with -Xlint:-path) Files we don't want on the classpath are being brought back onto...

How to reference an included file in OSGi bundle when performing java.io.File or FileInputStream

I am using the aQute Bnd toolset to create an OSGi bundle and have packaged with some dependant 'resource' files. This includes *.css files and *.xsd files in a resources directory I have created. I have included the following in the bundle.bnd file: Include-Resource: resources/=resources/ and when I do a build, the generated *.jar ...

referencing data files in jars

Hi, My Java program references a lot of data files. I put them in a top level directory called data/, along with src/ and bin/. In Eclipse, references to data/ and ../data/ both seem to work. When I run it from the command line, only ../data/ works. When I put the bin/ and data/ directories in a jar and correctly set the entry poi...

Open file; try filesystem first, then JARs

I'm trying to have my application load a resource (binary file) transparently: If the file exists under the current directory, open it. If not, try looking in the current JAR file if applicable. If not, try looking in other JAR files. (This is optional and I don't mind explicitly specifying which JAR files.) So far I know of File which...

Java Imports Error

I'm trying to import org.apache.commons.fileupload.* but I am being told that it does not exist. I am downloading this JAR: http://commons.apache.org/fileupload/ And placing it on the classpath. So what am I doing wrong here? ...

Java Classpath at Runtime

I am importing import org.apache.commons.httpclient.*; in a program, but whenever I go to run it, I have to include the JAR in the classpath. Why is this necessary? Are there any ways around this? ...

Unit testing both the presence/absence of a library

The question: Is there a way I can use a ClassLoader to test both the presence and absence of the library I'm checking for? I have a some code which will use a particular library if available, or fall back to some embedded code if not. It works fine but I'm not sure how to unit test both cases in the same run, or if it's even possible. ...

How can I read file from classes directory in my WAR?

I need to read text file from the classpath in Java WAR application. How can I read it as InputStream. File is located in /WEB-INF/classes/ folder, but when I use following code, it just returns null. InputStream input = servletContext.getClass().getClassLoader().getResourceAsStream("my_filename.txt"); ...

Does Spring MessageSource Support Multiple Class Path?

I am designing a plugin system for our web based application using Spring framework. Plugins are jars on classpath. So I am able to get sources such as jsp, see below ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] pages = resolver.getResources("classpath*:jsp/*jsp"); So far so good. But I have...

Creating a config list of classpath jars in ant

I have a list of jars in an ant task like this.. <path id="lib.path.id"> <fileset dir="${lib.dir}"> <include name="jar/*.jar"/> </fileset> </path> I want to unroll this into a config file like this.. wrapper.java.classpath.1=../lib/activation.jar wrapper.java.classpath.2=../lib/bcel.jar wrapper.java.classpath.3=../l...

Printing OSGI bundle classpath?

In a normal java application its possible to print the content of the classpath with: String ss = System.getProperty("java.class.path"); System.out.println(ss); But how do I print the classpath of an OSGI bundle created using the eclipse PDE wizard? In the activator its possible to get the current bundle like: public void start(Bundl...

Unable to find "Opportunity" class in SFDC (SalesForce)

SalesForce Opportunity example at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunity.htm#topic-title uses "Opportunity" class to begin with. For some reason I'm not able to find this class (or any Standard SalesForce classes) in the classpath at all. I'm able to find others classes though e.g. "com.sf...

Get a list of resources from classpath directory

I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List<String> getResourceNames (String directoryName). For example, given a classpath directory x/y/z containing files a.html, b.html, c.html and a subdirectory d, getResourceNames("x/y/z") should return a List<String> con...

Classpath problem: configLocation in Spring

I am having some kind of classpath problem: I've put my context.xml files in META-INF/spring/conf/ They can be perfectly found by Spring using classpath:WEB-META/spring/conf/root-context.xml (root-context.xml references other xml's). My Hibernate.cfg.xml is on src/main/resources, so it 'should' be on the classpath, however Spring does...

maven, eclispse and wtp broke for no reason: it stopped putting the mvn depentent jars in the WEB-INF/lib

Ive been running eclipse (Helios Build id: 20100617-1415), sonotype maven for eclipse version 2 (0.1.0.20100xxx) for many months without issue. I can do "mvn install" on the command line, and get a perfect war, and I could run the webapp in eclipse local tomcat no problem. Then this morning, I started tomcat in eclipse, hit the serlvet...

Ant -verbose fails with "package does not exist" despite jar being on classpath

I have the following code package myPackage; import org.neo4j.graphdb; import org.neo4j.kernel.EmbeddedGraphDatabase; public class dbServlet extends HttpServlet { public void init() throws ServletException { // Start up the database here GraphDatabaseService graphDb = new...

how to add one folder in classpath for ant script

hi, i need to add a folder in current classpath for ant script that i have written for running java files. please help me. ...

m2eclipse multiple dependencies on classpath

Hi folks, it might be a duplication, but in eclipse, how can I deal with various dependency versions of the same library in my local maven repository ? The problem is that dependency versions specified in pom definition are the libraries I need to use (they have sources/javadoc available etc.), but maven puts all the available library...

Use ItelliJ Idea module classpath when running Maven goal from ItelliJ Idea

Lets say I have two maven projects: moduleA and moduleB. moduleA has a dependency to moduleB in it's pom.xml. I use IntelliJ Idea, and I have 'Maven Projects' tool window, where I have both these maven projects. And it is possible to run maven plugin goals from there: I open 'Maven Projects' -> moduleA -> Plugins -> jetty -> jetty:ru...

Add classpath to folder containing property files in Maven

I have a property file which is not located in a classpath in Maven. Therefore I can't reach it with: ClassLoader.getSystemClassLoader().getResourceAsStream(PROPS_FILE); How can I add the folder containing the property file to the classpath, so it will be available during build and test of the project? ...