classpath

IntelliJ IDEA - Eclipse .classpath files and relative locations?

故事扮演 提交于 2019-12-10 16:24:47
问题 I'd like to use IntelliJ IDEA with an Eclipse project, without converting the project format. The main problem I'm running into right now is that in my .classpath file, we have entries like: <classpathentry kind="lib" path="/lib/whatever.jar" /> In Eclipse, that path is relative to the workspace root. But in IntelliJ, I believe it's looking for the actual "/lib" folder on my hard drive, which obviously doesn't exist. How can I maintain the Eclipse functionality while having IntelliJ look in

Nested Folders in Eclipse Classpath

放肆的年华 提交于 2019-12-10 16:05:45
问题 I'm trying to add two folders to my eclipse project's classpath, let's say Folder A and Folder B. B is inside A. Whenever I add A to the classpath <classpathentry kind="lib" path="/A"/> it works just fine, but I need to be able to access the files in B as well. Whenever I try to add <classpathentry kind="lib" path="/A/B"/> to the classpath, it says Cannot nest 'A/B inside library A' I'm a newbie when it comes to editing the classpath, so I'm wondering, is there is anyway to add a folder in

What is the effect of the dot (.) in the Java classpath?

你。 提交于 2019-12-10 15:55:42
问题 This is an example question from "SCJP mock exam": Given the default classpath: /foo And this directory structure: foo | test | xcom |--A.class |--B.java And these two files: package xcom; public class A { } package xcom; public class B extends A { } Which allows B.java to compile? (Choose all that apply.) A. Set the current directory to xcom then invoke javac B.java B. Set the current directory to xcom then invoke javac -classpath . B.java C. Set the current directory to test then invoke

scope “provided” does not add in jars in classpath

℡╲_俬逩灬. 提交于 2019-12-10 15:51:19
问题 I am using a dependency of scope "provided" pom file of an artifact. Because of "provided" scope, those dependency jars are not added in classpath of MANIFEST.MF. Could you help me so that the jars should not be downloaded but should be added in classpath. 回答1: Well, if you want it semantically right, remove <scope>provided</scope> and leave it default ( <scope>compile</scope> ). Then set <optional>true</optional> for a dependency, so it will be included in manifest's classpath. By using

Is it correct or incorrect for a Java JAR to contain its own dependencies?

感情迁移 提交于 2019-12-10 15:49:10
问题 I guess this is a two-part question. I am trying to write my own Ant task ( MyFirstTask ) that can be used in other project's build.xml buildfiles. To do this, I need to compile and package my Ant task inside its own JAR. Because this Ant task that I have written is fairly complicated, it has about 20 dependencies (other JAR files), such as using XStream for OX-mapping, Guice for DI, etc. I am currently writing the package task in the build.xml file inside the MyFirstTask project (the

Use javac with multiple specific jars on classpath in Linux (tilde doesn't expand after colon)

泪湿孤枕 提交于 2019-12-10 14:58:44
问题 I'm trying to compile a java source file that uses two jar files (trove and apache commons collections) via commands similar to the following javac -cp ~/.m2/repository/gnu/trove/trove/3.0.0/trove-3.0.0.jar:~/git-workspace/grid/libs/commons-collections-3.2.1.jar $(find . -name TimeJavaCode.java) In the above case, the commons code is not successfully included and there is a compile error where I'm using the commons library. If I reverse the order of the imports, then there are compile errors

A question about Eclipse and classpath in a Run configuration

半城伤御伤魂 提交于 2019-12-10 14:57:02
问题 I've just started using Log4J for the first time. I created a log4j.properties file and put it in my project's folder in Eclipse. I also created a Run configuration for my application (it's just a default Run configuration, no extra options). Now, I try running the application and I get an error message about log4j not being able to initialize itself (read the properties file). I know that the properties file must be in the classpath, so obviously the Run configuration is not setting the

ClassNotFoundException: org.jaxen.JaxenException in ear file

不想你离开。 提交于 2019-12-10 14:51:50
问题 I'm baffled by what is going on here. I keep getting the following exception: Caused by: java.lang.ClassNotFoundException: org.jaxen.JaxenException at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) ... 51 more Yet, this class file IS in my ear and

Loading XML File which is in classpath in Java

主宰稳场 提交于 2019-12-10 13:47:23
问题 I need to load a xml file present in classpath into my java applicatio. Can any one give suggestions on this. Thanks, Narendra 回答1: Use ClassLoader.getResourceAsStream or Class.getResourceAsStream, and then load it as you would for any other InputStream . (The difference between using the ClassLoader version and the Class version is how "relative" resource paths are resolved. With the ClassLoader version, it's always effectively treated as an absolute path; with the Class version, if the path

javah生成C++头文件(.h)

梦想与她 提交于 2019-12-10 13:42:34
在eclipse中建一项目,建一class,即TestHello.java文件 1 package esmart.colfile.parse 3 public class TestHello { 4 static { 5 System.loadLibrary( " TestHello " ); 6 } 8 public static native void hello(String msg); 10 public static void main(String[] args) { 12 hello( " Hello,Kimm! " ); 14 } 15 } 往往报如下的错误,就是因为shell命令的格式不对,应该严格按照我下面描述的格式来写,尤其注意第二步第三句的点和空格,就不会出错了。 错误: 无法访问 esmart.colfile.parse.TestHello 找不到文件 esmart.colfile.parse.TestHello.class javadoc: 错误 - 找不到类 esmart.colfile.parse.TestHello。 Error: 未在命令行中指定任何类。请尝试使用 -help 打开cmd命令框,输入shell命令,按照如下顺序输入 : 第一步 :进入TestHello.java文件的上级目录,编译该文件,则能在G:\work\eclipse