classpath

making class accessible from class path in dynamic class loading

I have a project created in Eclipse, and I defined an interface and a class for dynamic class loading, the class is in the project directory, so I have this code in my project: if (handlerClassName != null) { TypeHandler typeHandler = null; try { typeHandler = (TypeHandler) (Class.forNam...

Java Classpath Problems in Ubuntu

First off I'm running Ubuntu 9.10 I've edited the /etc/environment file to look like this: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.20" CLASSPATH="/home/travis/freetts/lib/freetts.jar:/home/travis/freetts/lib/jsapi.jar:." I then run "source /etc/environmen...

What's the diffrence btw System property and system environment variable

Hi all I am not clear about this. When I run a java App or run an Applet in applet viewer,( in the IDE environment), System.getProperty("java.class.path") give me the same as System.getenv("CLASSPATH"), which is the CLASSPATH env variable defined. But when I deploy my applet to webserver and access it from the same computer as a clien...

Spring Roo unable to generate Selenium tests because of Xerces error

After watching Roo Google IO, I decided to try it out using this tutorial, but I'm getting stuck when trying to create Selenium tests. ~.web roo> selenium test --controller ~.web.PizzaOrderController Created SRC_MAIN_WEBAPP/selenium Created SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml Created SRC_MAIN_WEBAPP/selenium/test-suite.xhtml...

include external jar when running java -jar

From my readings, when you execute a command as follows: java -jar foo.jar Then the main classpath is ignored and the classpath is taken from the manifest file. Further, the classpath declared on the command line is also ignored. So in: java -classpath /usr/local/jar/foobar.jar -jar foo.jar /usr/local/jar/foobar.jar is ignored. ...

Jar not found when executing class

Hi there, I'm working through a ANTLR (a language processing library) book and there are many examples that should be easy to compile using the command line. Some information to get te problem: antlr-3.2.jar contains the library classes. I added the antlr-3.2.jar to the CLASSPATH environment variable (Windows 7) and when compiling th...

Loading velocity template inside a jar file

I have a project where I want to load a velocity template to complete it with parameters. The whole application is packaged as a jar file. What I initially thought of doing was this: VelocityEngine ve = new VelocityEngine(); URL url = this.getClass().getResource("/templates/"); File file = new File(url.getFile()); ve = new V...

Is the Java classpath final after JVM startup?

Hi, I have read a lot about the Java class loading process lately. Often I came across texts that claimed that it is not possible to add classes to the classpath during runtime and load them without class loader hackery (URLClassLoaders etc.) As far as I know classes are loaded dynamically. That means their bytecode representation is o...

How can I add domain root to the WebLogic AdminServer classpath?

How can I add the domain root path to the Oracle WebLogic 11g (10.3.2) AdminServer classpath? (Note that I am not running the Node Manager.) Which WebLogic startup script sets environment variable WEBLOGIC_CLASSPATH? Is this the variable to which I should add the domain root? ...

Is it possible load all properties files contained in a package dynamically? i.e. MyClass.class.getResource('*.properties');

I am familiar with obtaining the contents of a properties file given the name of the file, and obviously MyClass.class.getResource('*.properties') will not work, but how can I obtain a list of ALL the properties files located in the same package as my class? ...

setting Java Classpath in linux ???

I downloaded apache-log4j-1.2.16.zip unziped . renamed it as LOG4J_HOME and placed it in /home/appnetix folder which is my folder. Now I'm setting the classpath using terminal by the following command :- [appnetix@Sanjeev ~]$ set classpath=%path%;LOG4J_HOME/log4j-1.2.16.jar; & I got this bash: LOG4J_HOME/log4j-1.2.16.jar: Permission den...

Eclipse: Is there an easy way to coordinate "Installed JREs" across a team?

I have an application that is composed of about 10 different Eclipse projects. Some projects must be built with Java 5, and others with Java 6. I have both of these JDKs registered with Eclipse's "Installed JREs" list as "jdk5" and "jdk6", respectively. The appropriate JRE is on each project's build class path, which is reflected in the...

How do you configure a Spring bean container to load a Java property file?

How do you configure a Spring bean container (or application context) to load a Java property file? JavaWorld article Smartly Load Your Properties explains how to load property files from the classpath using one of the following resource processing methods in the standard Java library: ClassLoader.getResourceAsStream ("some/pkg/resourc...

Problems including jar files outside the jar file containing the manifest

Basically let me first explain what I am aiming to do. I have a dynamic ETL transformer app written in JAVA. Due to the dynamic nature of this app I have to be able to add plugins jars to the app in a location outside of the apps jar file. Basically would like to have the following directory structure: AppFolder |- plugins/ |- configs/ ...

Different behaviour on Windows and Linux - classpath in build.xml (ant file)

I am trying to run the eBaySDK (Java) on Windows, but I kept on getting the error: com.ebay.sdk.SdkException: com.sun.org.apache.xerces.internal.dom.DocumentImpl Now, when I tried to run the same sample code included in the eBay SDK on Linux (ubuntu), it ran perfectly. Without any changes in the code. So, when I looked back in the...

Maven jetty plugin and the resources directory

Should I expect files in main/resources to be on the classpath when running the maven jetty plugin? Meaning will they be available to the app I'm running inside jetty? Will I be able to load them as classpath resources rather than via the file system? The same question goes for running junit tests inside Eclipse, using the Eclipse Maven...

Should all resources in a java web application be uniquely named?

Trying to understand resources in java-land. I believe the following is true: Resources loaded via the classpath have no namespace, they only have a file name. It's wisest to always load resources via the classpath, never via the file system, even in unit tests. Therefore, resources must always have unique file names, or collisions w...

Eclipse: find resource on classpath

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 o...

JUnit unable to find tests in Eclipse

I have a strange issue with JUnit 4 tests in Eclipse 3.5 that I couldn't solve - any hints gratefully received! Initially: I had a test suite working properly, with 100+ tests all configured with JUnit 4 annotations. I'd run these typically by right clicking on my source folder and selecting "Run as JUnit test". All worked perfectly. N...

Whitespaces in CLASSPATH

I am working on a Windows PC and have cygwin on it! I have organized all my jars under a directory within a few directories! I am writing a bash script to set the CLASSPATH by iterating through the directory that is passed as a parameter as follows: for JAR_FILE in `ls *.jar` do CLASSPATH="$DIRECTORY_TO_LOOK_FOR_JARS"/$JAR_FILE:$CLA...