classpath

Yet another Ant + JUnit classpath problem

天涯浪子 提交于 2019-12-01 03:57:10
问题 I'm developing an Eclipse SWT application using Eclipse. There are also some JUnit 4 tests, which test some DAO's. But when I try to run the tests via an ant build, all of the tests fail, because the test classes aren't found. Google brought up about a million of people who all have the same problem, but none of their solutions seem to work for me -.- . These are the contents of my build.xml file: <property name="test.reports" value="./test/reports" /> <property name="classes" value="build" /

ZipException when running junit tests

╄→гoц情女王★ 提交于 2019-12-01 03:56:46
I've been trying in vain to get ant to execute some tests written in junit. Any advice would be much appreciated. I'm pretty new to both ant and Java so please be patient. As a quick summary, what i'm doing is trying to get ant to execute a very simple test, the classpath looks ok considering the output from ant -debug. I'm getting a null test error for a test who's class file is explicitly mentioned in the classpath. Also, i'm getting a ZipException, i dont know what that's about. Here's a testcase i'm trying to run: package testmanagment; import junit.framework.*; public abstract class

bootstrap class path not set in conjunction with -source 1.6

跟風遠走 提交于 2019-12-01 03:40:18
I am upgrading my application from java 1.6 to 1.7. When I try to build using Maven 3.2.1, my build fails with below error msg: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project my-app5: Compilation failure: Compilation failure: [ERROR] could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.6 I am using java 1.7 hotspot and previously I was using 1.6 jrockit. My application is multi module and few modules compile and build as usual, this module failed. I have set java

Java : programmatically determine all of the package names loaded on the classpath

会有一股神秘感。 提交于 2019-12-01 03:19:01
Any suggestions as to how to approach how I would find out a list of package names that exist on the current classpath ? This needs to be done programmatically at run time by one of the classes loaded (and executing) on the classpath (i.e. inside out , not outside in). More details: One approach I considered was to use reflection on each of the classes loaded thus far by the class loader, and extract the package names from them. However, my application already runs into thousands of classes, so I need a more efficient approach. Another thing I considered was something analogous to finding out

How to set CLASSPATH in Linux to let java find jar file?

一笑奈何 提交于 2019-12-01 01:49:54
Under Linux I am trying to run a jar file as follows: java -jar plantuml.jar -testdot while having CLASSPATH set to any of the following (the file is located at /home/user/plantuml.jar ): export CLASSPATH=/home/user export CLASSPATH=/home/user/ export CLASSPATH=/home/user/plantuml.jar In either case, no matter how I define CLASSPATH , the java command gives an error Unable to access jarfile plantuml.jar . What am I doing wrong here? You have to supply the complete path after the parameter -jar . So for your example you have to call java -jar /home/user/plantuml.jar -testdot The $CLASSPATH is

How to set the class path in Eclipse and Android Studio

淺唱寂寞╮ 提交于 2019-12-01 01:47:38
问题 I've heard that you can use classpath to use classes in other libraries. I googled about this and all results tell me to use the command line to compile the program and specify a classpath. But who would use command line to compile java programs nowadays? I am using eclipse and Android Studio. I mean they are IDEs so they surely can set the classpath very easily, right? Also, I want to know the word "library" in this context is just a jar file , right? 回答1: In Eclipse: Right-Click on the

How does the java compiler find the class files whereas the classpath is not set to the jdk path?

谁说我不能喝 提交于 2019-12-01 01:26:56
问题 I'm trying to look under the hood about java compilation. So I put my IDE away and started using MS-DOS command-line... I created a simple project, as described in the tree below : SampleApp |____**src** |_____pack |______Sample.java |____**classes** This is the Sample.java source code : public class Sample { private String s = new String("Hello, world"); public Sample(){ System.out.println(s); } } I just want to compile this class, so I used the javac command : prompt\SampleApp\src>javac -d

ZipException when running junit tests

 ̄綄美尐妖づ 提交于 2019-12-01 01:26:36
问题 I've been trying in vain to get ant to execute some tests written in junit. Any advice would be much appreciated. I'm pretty new to both ant and Java so please be patient. As a quick summary, what i'm doing is trying to get ant to execute a very simple test, the classpath looks ok considering the output from ant -debug. I'm getting a null test error for a test who's class file is explicitly mentioned in the classpath. Also, i'm getting a ZipException, i dont know what that's about. Here's a

Add properties file to build path of runnable jar

£可爱£侵袭症+ 提交于 2019-12-01 01:22:44
is it possible to add to the classpath of a runnable jar file some properties file? I tryed these solutions solutions: running the executable file using the following command: java -cp ../prop_dir/prop1.properties;../prop_dir/prop2.properties -jar MyRunnableJar.jar adding to the MANIFEST FILE (in the Class-Path section) ../prop_dir/prop1.properties ../prop_dir/prop1.properties but none of them works. The architecture of the running dir is the following + + MyRunnableJar.jar + prop_dir/ + prop1.properties + prop2.properties Thanks so much, Daniele EDIT When I execute the following line System

How to include the lib folder in the manifest classpath in Netbeans

那年仲夏 提交于 2019-12-01 01:02:53
A library that my java application uses needs looks for a file (log4j.xml) in the class path. I use netbeans to manage my project, but I can't find a way to include the lib/ folder. Netbeans automatically creates a MANIFEST.MF file inside the application jar and also creates a folder called lib/ which includes all dependencies. This manifest specifies a Class-Path attribute that overrides any -cp argument provided on the command line. I can select an arbitrary folder in netbeans' library panel, but it creates a sub folder in the manifest's classpath. I'd like all dependencies and the log4j.xml