classpath

How do you configure a Spring bean container to load a Java property file?

被刻印的时光 ゝ 提交于 2019-12-02 19:37:11
How do you configure a Spring bean container (or application context) to load a Java property file? JavaWorld article Smartly Load Your Properties explains how to load property files from the classpath using one of the following resource processing methods in the standard Java library: ClassLoader.getResourceAsStream ("some/pkg/resource.properties"); Class.getResourceAsStream ("/some/pkg/resource.properties"); ResourceBundle.getBundle ("some.pkg.resource"); How can you do the same using a Spring bean container? The Spring Framework Reference Documentation (2.5.x) gives two examples of how to

setting the correct classpath for compiling and running Java packages? [duplicate]

主宰稳场 提交于 2019-12-02 19:17:51
问题 This question already has an answer here : getting error when I compile the Java code using package in commandline? (1 answer) Closed 5 years ago . I have been using Eclipse lately, where compiling and running the program is very simple. Not much needs to be done in setting the classpath . But apparently that is not the case when it comes to running them from commandLine . when I try compiling from terminal , I am having various errors. I am pasting an image of my package structure of the

Netbeans: need to include 3'rd party directory in classpath

a 夏天 提交于 2019-12-02 18:25:26
问题 We have an application developed in NetBeans, based on the NetBeans platform. There's a 3'rd party program that we have a runtime dependency on, more specifically a jar in the other progams lib folder. How should we include the other progam's jar in our classpath? The recommendation from the other progam's manufacturer is to set environment variable CLASSPATH to include C:\Progam Files\Other Program\lib\theJAR.jar And if that's not possible, we should copy theJAR.jar to JRE-HOME\lib\ext We

How to detect duplicate JARs in the classpath?

旧城冷巷雨未停 提交于 2019-12-02 18:07:15
Does anyone have code to detect duplicate JARs in the classpath? Background: When there are two versions of the same JAR in the classpath, really strange things can happen. This can even happen when using tools like Maven: Change a dependency and build the WAR without cleaning first. Since target/webapp/WEB-INF/lib wasn't cleaned, the dependency will be in there twice. Is there a safety-net for this? JBoss Tattletale might help you with this. It's a free tool which scans the JAR files used by your project and gives you a report about them. Amongst its feature are: Spot if a class is located in

NLTK Stanford Segmentor, how to set CLASSPATH

﹥>﹥吖頭↗ 提交于 2019-12-02 17:14:48
问题 I'm trying to use the Stanford Segementer bit from the NLTK Tokenize package. However, I run into issues just trying to use the basic test set. Running the following: # -*- coding: utf-8 -*- from nltk.tokenize.stanford_segmenter import StanfordSegmenter seg = StanfordSegmenter() seg.default_config('zh') sent = u'这是斯坦福中文分词器测试' print(seg.segment(sent)) Results in this error: I got as far as to add... import os javapath = "C:/Users/User/Folder/stanford-segmenter-2017-06-09/*" os.environ[

cmd java not working [duplicate]

旧城冷巷雨未停 提交于 2019-12-02 16:00:45
问题 This question already has answers here : Why can't I run my java Hello World program if it is inside a package? (3 answers) Closed 6 years ago . I'm currently learning Java and the use of my command prompt as a compiler. But every time I execute the java command followed by my test class "Hello" I get the below error messages: Exception in thread "main" java.lang.NoClassDefFoundError: Hello (wrong name: hello/Hello) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader

Java Audio Stream (mp3spi lib), UnsupportedAudioFileException

ε祈祈猫儿з 提交于 2019-12-02 14:46:12
问题 I have seen multiple Stack Overflow questions regarding streaming MP3 streams (like Icecast). They all say to use the MP3SPI libraries, which I am. MP3SPI is for allowing support to audio/mpeg mime types. That's what my Icecast stream is. I have all three jar files in my classpath correctly, but while using the same code they provide in an example, I still get UnsupportedAudioFileException : javax.sound.sampled.UnsupportedAudioFileException: could not get audio input str eam from input URL at

How to check the classpath where Jython ScriptEngine looks for python module?

人盡茶涼 提交于 2019-12-02 14:05:18
问题 I have this Java code which I am using to run a python script using Jython ScriptEngine : StringWriter writer = new StringWriter(); ScriptEngineManager manager = new ScriptEngineManager(); ScriptContext context = new SimpleScriptContext(); context.setWriter(writer); ScriptEngine engine = manager.getEngineByName("python"); engine.eval(new FileReader("/Users/folder1/test.py"), context); In my python script there are several module import statements and when I run the Java code I get error as

Missing file in java.library.path

一个人想着一个人 提交于 2019-12-02 13:59:27
问题 While compiling a demo from openni i stumbled across this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no OpenNI.jni in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1045) at org.OpenNI.NativeMethods.<clinit>(NativeMethods.java:34) at org.OpenNI.Context.initFromXmlEx(Context.java:317) at org.OpenNI.Context.createFromXmlFile(Context.java:36) at

Setting custom runtime classpath for a maven project in netbeans

╄→гoц情女王★ 提交于 2019-12-02 13:12:18
问题 I want to add a custom classpath when I'm running my maven project from within netbeans. So far I've tried adding the following to the Run Project action in the project properties: exec.args=-classpath %classpath;c:/QUASR/duplicateRemoval.jar;c:/QUASR/lib/QUASR.jar ${packageClassName} exec.args=-cp %classpath;c:/QUASR/duplicateRemoval.jar;c:/QUASR/lib/QUASR.jar ${packageClassName} exec.args=-cp c:/QUASR/duplicateRemoval.jar;c:/QUASR/lib/QUASR.jar ${packageClassName} but no luck, the custom