classpath

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

拜拜、爱过 提交于 2019-11-27 12:17:21
问题 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

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

痞子三分冷 提交于 2019-11-27 12:00:31
问题 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

How to add resources to classpath

ε祈祈猫儿з 提交于 2019-11-27 11:58:45
How do you add a folder (e.g. a resource folder containing arts) to the classpath of a netbeans project? I managed to do that manually via editing the NB generated jar file of the project (that is its MANIFEST.MF file + copying the resources manually), but there should be a way to tell netbeans as well to mind the resources, no? The folder structure looks like this: /project/art/ /project/dist/lib/ /project/dist/art/ /project/dist/project.jar /project/lib/ /project/src/ I don't want to package the art into the jar because I'd like the art to be easily exchangeable. If I add the art folder to

Using external properties files in weblogic

笑着哭i 提交于 2019-11-27 11:42:17
问题 I am working on deploying a J2ee application that I have previously been deploying in JBOSS into Weblogic 10.3.1.0. I am running into an issue with external properties files. In Jboss I can just put the properties files into $JBOSS_HOME/server/default/conf, and they are loaded onto the system classpath and I can access them without any problems. I was able to put shared libraries into $MIDDLEWAREHOME/user_projects/domains/mydomain/lib and they were loaded into the system classpath without any

How do I run an sbt main class from the shell as normal command-line program?

旧街凉风 提交于 2019-11-27 11:35:33
How can I run an sbt app from the shell, so that I can run my app as a normal command-line program (as if run directly via scala but without having to set up an enormous classpath)? I know I can do: echo hello | sbt 'run-main com.foo.MyMain3 arg1 arg2' > out.txt But this (1) takes forever to start because it starts sbt, (2) causes all stdout and stderr to go to stdout, and (3) causes all output to be decorated with a logger [info] or [error]. I looked at https://github.com/harrah/xsbt/wiki/Launcher but it seems too heavyweight, since it downloads dependencies and sets up a new environment and

Why can't System.setProperty() change the classpath at runtime?

做~自己de王妃 提交于 2019-11-27 11:23:31
I am refering to the question on changing the classpath programmatically. I read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties(). The answers however I got was that It Wont work. I have not tried this myself, however, i am taking the call. Just to clarify, then why these setProperty() and getProperty() methods are there if they cannot alter it at run time. Or is this specific to the classpath property only ? I will appreciate if someone can present a scenario where they are really

How do I define a compile-time *only* classpath in Gradle?

為{幸葍}努か 提交于 2019-11-27 11:17:32
Can someone please give me a simple build.gradle example of how I can specify compile-time-only classes that are not included in the runtime deployment (war). Gradle seems to have gotten this the wrong way around since 'runtime' inherits from 'compile'. I can't imagine a situation where I would want classes at runtime that I wouldn't want at compile time. However, there are many circumstances where I need classes to generate code at compile time that I do not wish to deploy at runtime! I've ploughed through the bloated gradle documentation but cannot find any clear instructions or examples. I

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

爱⌒轻易说出口 提交于 2019-11-27 11:10:20
问题 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

Dynamically loading plugin jars using ServiceLoader

坚强是说给别人听的谎言 提交于 2019-11-27 10:44:50
I'm trying to create a plugin system for my application, and I want to start with something simple. Every plugin should be packed in a .jar file and implement the SimplePlugin interface: package plugintest; public interface SimplePlugin { public String getName(); } Now I've created an implementation of SimplePlugin , packed in a .jar and put it in the plugin/ subdirectory of the main application: package plugintest; public class PluginTest implements SimplePlugin { public String getName() { return "I'm the plugin!"; } } In the main application, I want to get an instance of PluginTest . I've

Adding to the classpath on OSX

…衆ロ難τιáo~ 提交于 2019-11-27 10:27:11
Can anyone tell me how to add to the classpath on OSX? If you want to make a certain set of JAR files (or .class files) available to every Java application on the machine, then your best bet is to add those files to /Library/Java/Extensions . Or, if you want to do it for every Java application, but only when your Mac OS X account runs them, then use ~/Library/Java/Extensions instead. EDIT: If you want to do this only for a particular application, as Thorbjørn asked, then you will need to tell us more about how the application is packaged. In OSX, you can set the classpath from scratch like