classpath

How to launch a java CLI program, developped in Eclipse, from Cygwin bash shell ?

Hi all, I wanted to share here a useful script of mine. I am developing some java CLI software under Eclipse. For time to time, I find it useful to run it from the command line with custom arguments (with Cygwin in my case), instead of creating a new "Run configuration" in eclipse. My eclipse project depends on some other "core" projec...

JRuby on Rails: Adding a folder to the classpath

I'm trying to add an entire folder to the JRuby 1.5 classpath for my Rails app. The JRuby Wiki suggests the following: "... add the config directory to the JRuby classpath in config/environment.rb:" $CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/" That doesn't seem to work for me. It doesn't matter whether...

Classpath problem: .jar file can access a file from Class-Path in manifest, but not from -cp command line parameter

I have the file foo.jar in this directory structure: +--+- /foo_lib | | | +- Ice.jar ... | +-- /swt-linux-gtk -- swt.jar | +-- foo.jar where manifest says, in part: Class-Path: . foo_lib/Ice.jar swt-linux-gtk/swt.jar foo_lib/o rg.eclipse.core.commands_3.5.0.I20090525-2000.jar... It can be lauched without problem by the command ...

If you could substantially alter Java's classpath libraries, whichdifferent decisions would you make?

If you had the chance to significantly change/update Java's classpath libraries, which things would you add/update/change/deprecate/remove? ...

How to find current jvm classpath?

And then add a new path to it? My box is Vista Pro and the java installation is JDK 5.0 with updater 1. Thanks. ...

HttpClient NoClassDefFoundError

I am trying to run a sample application from HttpClient 4.0.1. It is the file ClientMultiThreadedExecution.java from the examples section. I put in these files in the classpath: apache-mime4j-0.6.jar;commons-codec-1.3.jar;commons-logging-1.1.1.jar;httpclient-4.0.1.jar;httpcore-4.0.1.jar;httpmime-4.0.1.jar and the file compiles correctl...

package org.hibernate.cfg does not exist import org.hibernate.cfg.Configuration;

I'm using hibernate & I got this error during compilation,so plz help me package org.hibernate.cfg does not exist import org.hibernate.cfg.Configuration; ...

Classpath variable in java

I'm reading a few files in my application and referring to them as new File("src/main/resource/filename") and it works. But when I package the jar with the Maven assembly plugin and run java - jar I get an error, naturally: Error occured: src\main\resources\UPDATE.txt (The system cannot find the path specified) Because there is no ...

Eclipse: specifying classpath in Manifest when creating a runnable jar

Hi All, I am using eclipse to create a runnable jar. During runtime my code looks through the classpath for a config file, which it reads in. However, as a runnable jar it is not finding this config file. I guess the config file will need to exist as a seperate entity on the filesystem somewhere. How do I specify the classpath in the ...

Obtaining the Web application classpath from within a servlet

The reason to do that is because I want to use Runtime.exec() using the same classpath as my servlet. The class I want to run is within WEB-INF/classes/my/package/. So I want to build a cmdarray as String[] {"java","-cp", my_servlet_classpatch, "my.package.myclass"} I just can't find a way to get my running servlet classpath. NB: This ...

Please help me Compile with different Classpaths in Java

My structure looks like this \Project1 \src \pkg1 Main.java \pkg2 Auxillary.java \Destination \class \lib I need to compile Main.java which has dependencies in Auxillary.java and jars in \lib into \Destination\class I am in the Project1 directory. I tried javac -cp Destination\lib\*;src\pkg2\* -d D...

log4j and java.lang.NoClassDefFoundError: org/apache/log4j/Layout

I am trying to get a piece of code working with log4j. If I run it via junit tests (ant task), I am getting proper log outputs and all is fine. If I run the code from the command line, I get this: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout at uk.co.bytemark.flexnbd.Main.main(Main.java:29...

Jar works with standalone hadoop, but not on the actual cluster (java.lang.ClassNotFoundException: org.jfree.data.xy.XYDataset)

Hi, I am trying to build my project using eclipse on windows and execute on a linux cluster. The project depends on some external jars, which I enclosed using eclipse's "Export->Runnable JAR -> Package required library into jar" build option. I checked the jar contains the classes within a folder structure, and the external jars are in ...

Spring classpath prefix difference

Documented here it states This special prefix specifies that all classpath resources that match the given name must be obtained (internally, this essentially happens via a ClassLoader.getResources(...) call), and then merged to form the final application context definition. Can someone explain this? What is the differ...

Eclipse gives error "... is not a valid location for linked resources."

When I try to add a new Classpath Variable in Eclipse for my Build Path configuration, and the path I add is a directory that the current workspace is a subdirectory of, Eclipse gives the error: 'C:\JavaStuff' is not a valid location for linked resources. Why does Eclipse impose this restriction? I can't think of a good reason for it...

WSDL2Java Throws Could not find main class: org.apache.axis.wsdl.WSDL2Java

I'm trying to use WSDL2Java on my Mac. I setup the CLASSPATH in bash. AXIS=/Users/bernie/axis-1_4/lib CLASSPATH=".:$AXIS/axis-ant.jar:$AXIS/axis.jar:$AXIS/commons-discovery-0.2.jar:$AXIS/commons-logging-1.0.4.jar:$AXIS/jaxrpc.jar:$AXIS/log4j-1.2.8.jar:$AXIS/saaj.jar:$AXIS/wsdl4j-1.5.1.jar"; But when I run java -cp $CLASSPATH org.ap...

How to add reference to .propeties file in .classpath

Hi, i've got exception, while running java class from Eclipse: java.util.MissingResourceException: Can't find bundle for base name dbconfig, locale en_US Seems that my dbconfig.properties file isn't in classpath. dbconfig.properties located in root of the project. Eclipse is ran with VM arguments(in Run configurations-->Arguments menu...

Eclipse - Setting .classpath file for existing project

I have a java project. The working folder from someone else's Eclipse project (It was a Repast Simphony project I think). In my eclipse I created a new Java project and told it to use the existing code. So it seems to have brought in all the code. However after loading the project I get this error: Project 'My Project' is missing re...

Loading classes not present in the classpath

Let's say I've compiled a Groovy script using Groovyc, which has generated one or more .class files in the file system. From a Java application, how do I add those classes to the classpath dynamically in order to load them and call their methods? The goal is to pre-compile Groovy scripts and store them into the database, so evaluation ca...

How do I dynamically load a Clojure script from outside of my classpath from java?

I wish to enable user defined Clojure scripts to interact with my Java App. The problem is, I don't know in advance where the Clojure scripts will be located, so I can't include them in my classpath when running the app. How do I dynamically load a Clojure script from outside of my classpath? I've tried the simple example: RT.loadReso...