classpath

Java project: should .classpath .project file be committed into repository? [duplicate]

坚强是说给别人听的谎言 提交于 2019-11-28 20:03:24
This question already has an answer here: .classpath and .project - check into version control or not? 7 answers Should I check in my .project and .classpath files? My friend told me that I should only check in .java files and the build.xml to guarantee portability. He said ".classpath will cause you much less portability on different environment. .project is entirely your local eclipse setting" I agree with him, but partially. -- Not checking in .project file will make my development less efficient (I can't simply "import" a project code from a directory) -- Not checking in .classpath file

Ubuntu: change the path from OpenJDK 6 to Oracle JDK 7

我只是一个虾纸丫 提交于 2019-11-28 19:22:49
After downloading the latest .tar file I ran tar zxvf jdk-7u45-linux-x64.tar.gz to extract java files. Set the path in .bashrc file ( vi ~/.bashrc ) as below; export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45/bin/java export PATH=$PATH:/usr/lib/jvm/jdk1.7.0_45/bin export JDK_HOME=/usr/lib/jvm/jdk1.7.0_45 export JRE_HOME=/usr/lib/jvm/jre1.7.0_45 Now, running command java -version or which java, java PATH still pointing to the older java version ( java version "1.6.0_27" ). I know default ubuntu takes OpenJDK path. I have to change the path as latest version as my system environment variable set in

Jar hell: how to use a classloader to replace one jar library version with another at runtime

风流意气都作罢 提交于 2019-11-28 19:10:33
I'm still relatively new to Java, so please bear with me. My issue is that my Java application depends on two libraries. Let's call them Library 1 and Library 2. Both of these libraries share a mutual dependency on Library 3. However: Library 1 requires exactly version 1 of Library 3. Library 2 requires exactly version 2 of Library 3. This is exactly the definition of JAR hell (or at least one its variations). As stated in the link, I can't load both versions of the third library in the same classloader. Thus, I've been trying to figure out if I could create a new classloader within the

using classpath: in spring

人走茶凉 提交于 2019-11-28 18:42:15
I have two questions regarding classpath: option in spring :- 1) Does classpath: search for resource relative to the document in which it is specified(in case of web applications)? Suppose I use the following: <bean class="mybean"> <property name="myresource" value="classpath:myfile.txt"/> </bean> in myconfig.xml under /WEB-INF/classes/config/myconfig.xml . Then from where it will start its search? 2)Is it faster to search if I give direct location of the resource instead of giving classpath: i.e <bean class="mybean"> <property name="myresource" value="classpath:/WEB-INF/classes/myfolder

Loading spring application context files that are inside a jar in classpath

痴心易碎 提交于 2019-11-28 18:15:32
I am trying to use ClassPathXmlApplicationContext in my java standalone code to load applicationContext.xml that is inside a jar file which is in my class path. ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:**/applicationContext*.xml"); applicationContext.xml entry as follows, <bean id="myAdder" class="com.foo.bar.MyAdder"> <property name="floatAdder" ref="floatAdder"/> </bean> And, when I try to load a bean that way I am getting NoSuchBeanException. Can't a bean by loaded in this way? The jar file is added to my classpath as a maven dependency. When I see the

IntelliJ can't find classpath test resource

狂风中的少年 提交于 2019-11-28 17:10:44
I'm having a problem where IntelliJ 13.1.4, when running a unit test, can't find a ServiceLoader file in the src/test/resources directory of my module. Please note before answering that I've done all of the following: The module is a Gradle project, and if I run gradle test the unit test runs fine. I've run this unit test successfully in IntelliJ in the past, and it found the module. (Maybe an earlier version of IntelliJ?) I've double checked the IntelliJ module settings and the src/test/resources directory is marked as being a test resources directory. (See screenshot below.) I'm dumping the

Is it possible to have Ant print out the classpath for a particular target? If so, how?

自闭症网瘾萝莉.ら 提交于 2019-11-28 16:56:17
I'm trying to get a target to build that has quite a long list of <pathelement location="${xxx}"/> and <path refid="foo.class.path"/> elements in its <path id="bar.class.path"> element (in the build.xml file). I keep getting "package com.somecompany.somepackage does not exist" errors, and I'm having a hard time chasing down these packages and making sure I've synced them from our repository. I'm new to this team so I'm unfamiliar with the build, but I would prefer to figure this out myself if possible (so I don't bother the other very busy team members). I have very limited experience with Ant

Difference between classpath and endorsed directory

倖福魔咒の 提交于 2019-11-28 16:52:34
问题 Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath? Is it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classpath? 回答1: Tecnically you probaly can do that, but the difference is that the jar files in the endorsed directory are loaded by the bootstrap classloader, which is probably not the same classloader as the one that loads

How can I add jars to the classpath when I invoke Jython *without* adding them to $CLASSPATH?

二次信任 提交于 2019-11-28 15:47:26
问题 I'd like to do something similar to jython -cp FOO:BAR:BAZ argle.py . If I add FOO , BAR , and BAZ to $CLASSPATH this works. I tried to add them to sys.path at run-time, but that doesn't appear to work for jars. It does work if I add a path to the expanded jars to sys.path at runtime. Is there a simple alternative to exploding the jar files? Augmenting $CLASSPATH for every user that runs this script is not an acceptable alternative. Thanks. 回答1: You can use the -D option to set python.path :

CLASSPATH, Java Buld Path (eclipse), and WEB-INF\\LIB : what to use, when, and why?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 15:44:13
I recently switched to J2EE from .NET, and am confused about where to put JAR files. I know that the CLASSPATH, WEB-INF, and Eclipse's Java Web Path are all places where JARs can be stored, but I'm confused about which folder to use, when, and why. First off, we have the CLASSPATH. I usually set this by going into "Environment Variables" inside "My Computer." I know that this is the default place where the Java compiler looks for JAR files. When I add a folder or a JAR to my CLASSPATH environment variable, why is it ignored by Eclipse, the Java compiler, and the web server? Also, I know that