classpath

Cannot resolve package org.apache.commons.vfs exception

安稳与你 提交于 2019-12-11 07:48:50
问题 I am getting an exception in my code saying org.apache.commons.vfs.* cannot be resolved . Could someone please explain why this is occurring, and how it can be fixed. This is my code... import org.apache.commons.vfs.FileChangeEvent; import org.apache.commons.vfs.FileListener; import org.apache.commons.vfs.FileObject; import org.apache.commons.vfs.FileSystemException; import org.apache.commons.vfs.FileSystemManager; import org.apache.commons.vfs.VFS; import org.apache.commons.vfs.impl

Trouble working on Java app between Windows and Snow Leopard machines

孤人 提交于 2019-12-11 07:35:09
问题 There has got to be a simple solution to this, but I'm having trouble working on a Java application on a Windows machine and a Snow Leopard machine. I'm doing all of my development in Eclipse and transferring the code via SVN checkins/checkouts. The problem I'm having is the application references a bunch of Snow Leopard JDK jars and refers to them via an absolute location in the classpath. Does anybody have experience working in this type of environment and how do you get around it? 回答1:

java.lang.ClassNotFoundException: antlr.ANTLRException but I have antlr-2.7.6 in folder lib of project

和自甴很熟 提交于 2019-12-11 06:19:01
问题 I have this in .classpath: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> ... ... <classpathentry kind="lib" path="lib/hibernate3.jar"/> <classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/> ... </classpath> Some .jar added. When I try this: Query query2 = session.createQuery(sql2); throw exception in question name: java.lang.ClassNotFoundException: antlr.ANTLRException Any idea? Thanks in advance. Greetings. 回答1: This is related to the Hibernate

specifying log4j in classpath

…衆ロ難τιáo~ 提交于 2019-12-11 05:56:38
问题 I believe this is how I can compile and run a file that uses external library. I'm using Windows. top level directory | |-log4-1.2.17.jar |-MyApp.java |-com |-foo |-Bar.java Compiling javac -cp log4j-1.2.17.jar;. com\foo\Bar.java javac -cp log4j-1.2.17.jar;"com\foo";. MyApp.java Executing java -cp log4j-1.2.17.jar;"com\foo";. MyApp Compiling itself failed. 回答1: simple batch script, for compiling all your project set COMPILED_CLASSES=.\ set TEMP_FILE=temp dir .\*.java /s /B > %TEMP_FILE% javac

Travis CI and JUnit with Gradle cannot find classpath resources

会有一股神秘感。 提交于 2019-12-11 05:48:40
问题 I have a project whose complete source you can find at its GitHub page here on the feat/config branch. The problem I am having is that ClassName.class.getClassLoader().getResourceAsStream() always returns null , and creating a File with the complete path (including the source directory) also returns a FileNotFoundException . This code should load the default configuration values out of a classpath resource and write it to a File . It works locally but fails on Travis CI. public static void

When creating a jar file how do I retain the existing classpaths to other jar files?

被刻印的时光 ゝ 提交于 2019-12-11 05:23:35
问题 I recently completed a college Java assignment. The assignment utilised various other jar files, e.g. mysql connector. When I created a jar file from the Java programs in the project the connections to these other jar files were lost. I tried various different combinations when creating the jar file and once included the mysql connector, but to no avail. I didn't expect this to work as my research had shown that usually only sound effects and images are classed as acceptable additional files.

Running Java Program in Sub-Directory

断了今生、忘了曾经 提交于 2019-12-11 05:06:25
问题 Please give suggestions if my formatting is wrong, this is my first time posting a question here. Using UNIX, I'm having trouble running a Java program 'Master' (located in a sub-directory) from the top-level directory. Compiling works just fine from the top-level, but I can't actually run the java code from the top-level. I think I may be misunderstanding classpath / the classpath flag. My directory structure is like so: /top-level/src/amsPassageretriever. When I try to run everything from

NoClassDefFoundError when adding classes to the classpath at runtime when I used abstract or interface in Main class

孤人 提交于 2019-12-11 04:44:49
问题 I know Java loads Classes in first Access (creating new Instance, calling static method or static field), but in this simple example I try to execute a jar file that uses some classes which there aren't in my ClassPath at run time. I expect (because of loading classes in first access) print my messages in static block and main method before an exception occurred. but I got "Exception in thread "main" java.lang.NoClassDefFoundError: com/example/DateAbstract" and nothing printed. This occurred

Could not find or load main class on simple Java Soup app [duplicate]

妖精的绣舞 提交于 2019-12-11 04:41:41
问题 This question already has answers here : What does “Could not find or load main class” mean? (46 answers) Closed 2 years ago . I do the compilation of this simple programm i found here package com.stackoverflow.q2835505; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Test { public static void main(String[] args) throws Exception { String url = "https://stackoverflow.com/questions/2835505"; Document

Cannot find class in classpath issue with TESTNG

跟風遠走 提交于 2019-12-11 03:22:37
问题 WE are integrating testng with our application, I created testng.xml and testngbuild.xml for ant build . While running ant build it is throwing Cannot find class in classpath:. Actually I tried many ways. But I am still hopeless. Even I tried copying manually .class file to my testng directory of the application. If you can do like this, It is throwing another exception as could not load .class file 回答1: Even I faced the same problem many a times. You can try below solutions which worked for