classpath

ColdFusion: about using custom “own written” Java classes

孤街醉人 提交于 2019-12-17 16:48:28
问题 I need to use my own java class in a cfml page. This entry in the documentation sounds great but does not explain which files I have to create. I tried to create a test.cfm page under my website root. Then placed TestClass.java + TestClass.class in the same path. But that results in an error "class not found"!. Can you please help me? 回答1: a TestClass.java + TestClass.class in the same path. You cannot just place .class files anywhere. When the CF server starts, it only checks specific

How can I read file from classes directory in my WAR?

流过昼夜 提交于 2019-12-17 16:47:13
问题 I need to read text file from the classpath in Java WAR application. How can I read it as InputStream. File is located in /WEB-INF/classes/ folder, but when I use following code, it just returns null. InputStream input = servletContext.getClass().getClassLoader().getResourceAsStream("my_filename.txt"); 回答1: Prefix it with a forward slash to denote the root of the classpath: getResourceAsStream("/my_filename.txt") Alternatively, you can use the serlvetContext.getResourceAsStream(..) which

Maven: add a folder or jar file into current classpath

穿精又带淫゛_ 提交于 2019-12-17 16:06:08
问题 I am using maven-compile plugin to compile classes. Now I would like to add one jar file into the current classpath. That file stays in another location (let's say c:/jars/abc.jar . I prefer to leave this file here). How can I do that? If I use classpath in the argument: <configuration> <compilerArguments> <classpath>c:/jars/abc.jar</classpath> </compilerArguments> </configuration> it will not work because it will override the current classpath (that includes all the dependencies) Please help

In JShell, how to import classpath from a Maven project

核能气质少年 提交于 2019-12-17 15:51:39
问题 I have a local Maven project under development. How can I launch jshell with the project class path with all the dependencies, so that I can test project or dependency classes inside JShell. 回答1: You can use the jshell-maven-plugin: mvn com.github.johnpoth:jshell-maven-plugin:1.1:run which will fire up a JShell session with your project's runtime path. If you want to include your test dependencies just add -DtestClasspath to the command. Source code: https://github.com/johnpoth/jshell-maven

Does Spring MessageSource Support Multiple Class Path?

*爱你&永不变心* 提交于 2019-12-17 15:44:49
问题 I am designing a plugin system for our web based application using Spring framework. Plugins are jars on classpath. So I am able to get sources such as jsp, see below ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] pages = resolver.getResources("classpath*:jsp/*jsp"); So far so good. But I have a problem with the messageSource. It seems to me that ReloadableResourceBundleMessageSource#setBasename does NOT support multiple class path via the "classpath*

Updating a JAR whilst running

我的未来我决定 提交于 2019-12-17 15:38:55
问题 Given a jar runs within a JVM would it be possible to unload the current running Jar and remove it from the system. Download a new version and rename it with the same name of the last Jar and then initialise the new Jar, creating a seamless update of the Jar within the JVM. Is it even possible to instruct the JVM to perform this action? Is it even possible to update a Jar whilst its running? 回答1: Download a new version and rename it with the same name of the last Jar and then initialise the

Interpreting eclipse .classpath file. What does 'kind=“con”' and 'exported=“true”' mean?

一曲冷凌霜 提交于 2019-12-17 15:38:45
问题 This is the eclipse .classpath file of the eclipse plugin program that I downloaded. I think that kind="src" and kind="output" is pretty straight forward, as they means the where the source java files and compiled class files are located. The kind="lib" seems to indicate the jar files the plugin is referencing, but I have something that I'm not sure about. What does the kind="con" mean? What is it for the exported="true" ? I think in order to use this plugin, all the jar files that the plugin

ClassLoader getResourceAsStream returns null

こ雲淡風輕ζ 提交于 2019-12-17 10:57:14
问题 My project directory structure (in Eclipse): MyProject/ src/ --> "source directory" on Eclipse's classpath/buildpath com.me.myapp Driver myconfig.txt In Driver , I have the following code: public class Driver { public static void main(String[] args) { InputStream is = ClassLoader.getSystemClassLoader.getResourceAsStream("myconfig.txt"); if(is == null) System.out.println("input stream is null"); else System.out.println("input stream is NOT null :-)"); } } When I run this I get the following

ClassLoader getResourceAsStream returns null

不羁的心 提交于 2019-12-17 10:57:08
问题 My project directory structure (in Eclipse): MyProject/ src/ --> "source directory" on Eclipse's classpath/buildpath com.me.myapp Driver myconfig.txt In Driver , I have the following code: public class Driver { public static void main(String[] args) { InputStream is = ClassLoader.getSystemClassLoader.getResourceAsStream("myconfig.txt"); if(is == null) System.out.println("input stream is null"); else System.out.println("input stream is NOT null :-)"); } } When I run this I get the following

Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger

浪子不回头ぞ 提交于 2019-12-17 10:39:13
问题 I've got an interesting problem in which the org.apache.log4j.Logger class is not found during runtime. I'm trying to get authorized and that is where it's failing: OAuthAuthorizer oauthAuthorizer = new OAuthAuthorizer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, SAML_PROVIDER_ID, userId); I'm using JDeveloper 11.1.1.6. Here is what I know: I've looked in my UI.war/WEB-INF/lib directory and I see the log4j-1.2.17.jar there. The class complaining about it is org.opensaml.xml.XMLConfigurator