classpath

Getting Resources from a jar: classloader vs class resourceasstream

烈酒焚心 提交于 2019-12-24 02:39:05
问题 I am trying to implement a method that when called, get a string from a particular resource in the jar that the class is loaded from. For example: import mypath.myclass; //from a jar String result = gitid.getGitId(myclass.class); On the backed I am currently using: InputStream is = null; BufferedReader br = null; String line; is = c.getResourceAsStream("/com/file.text"); The problem is I keep getting the same resource for no matter what class I give it. I have also tried: is = c

Eclipse not using jars from add classpath variable

不问归期 提交于 2019-12-24 02:33:09
问题 I added a classpath variable (via eclipse's build path) that points to a cache of jars. While this folder is represented in eclipse's folder view, the contained jars are not recognized for some reason. For example, when I import a class that is present in a jar in the cache (and thus the added classpath variable), eclipse indicates that the class can not be resolved. Any ideas what is wrong and how to resolve it? 回答1: You have to make sure that the jar(s) that you want are actually included

Javadoc: Annotations from third party libraries

旧街凉风 提交于 2019-12-24 01:44:27
问题 I'm trying to write an SVN Post-Commit hook to generate javadoc on a webpage whenever someone submits any changes to relevant files. I was new to the hook concept, but I didn't expect to run in any strange errors when generating the javadoc. java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46) at com.sun.tools.doclets.internal.toolkit.util.Util

Can not load the images in Java Swing when running from a .jar-file

自古美人都是妖i 提交于 2019-12-24 01:24:48
问题 I can run my Java Swing application from Eclipse without problems. But when I run it from a .jar-file, the images fails to load. I load my images with: setIconImage(Toolkit.getDefaultToolkit(). getImage(getClass().getResource("../images/logo.png"))); How can I load the images so they work even when I'm running from a .jar-file? The images is in the same Jar-file, in the packet com.example.images and the class where they are used is in com.example.gui.dialogs 回答1: Use the absolut path inside

Java environment variables set correctly, but java is not finding the jars

眉间皱痕 提交于 2019-12-24 01:00:45
问题 Summary Java environment variables correctly set, as seen from echo-ing them. However, jars are only seen when explicitly included with javac command. Details This is not specifically related to graphics and OpenGl, certain the problem is related to classpaths, ie the importing of third-party jar files. Using Windows XP SP3, JDK 1.7.0_13 On Windows xp, the system environment variables PATH/JAVA_HOME/CLASSPATH have been set/added-to to include these directories: C:\Documents and Settings

How to add external resources (properties file) on to the classpath so that war can read?

懵懂的女人 提交于 2019-12-23 23:25:05
问题 We have small problem in adding the external directory (having config.properties) to the classpath. If we add this to the classpath, we should be able to read it in the web application. There are some spring applications in web application which will read the external properties file. I don't find the correct solution any where ? Could you please point me the right direction ? Thanks, Rama Krishna 回答1: I had the similar requirement and I did the followings: 1) Added the properties folder path

ClassPath in manifest does not work

倾然丶 夕夏残阳落幕 提交于 2019-12-23 20:14:03
问题 Structure of files in my jar is: com/my/Main.class META-INF/MANIFEST.MF RXTXcomm.jar Manifest.mf consist: Manifest-Version: 1.0 Main-Class: com.my.Main Class-Path: RXTXcomm.jar (empty line present) When I run my jar as: java -jar my.jar I get: Exception in thread "main" java.lang.NoClassDefFoundError: gnu/io/SerialPortEventListener What is wrong? 回答1: What is wrong? You have packaged the jar dependency inside your main jar. The intention of Class-Path is to add an external jar to the

Does GWT have its own notion of classpath?

六月ゝ 毕业季﹏ 提交于 2019-12-23 20:01:08
问题 Does the GWT compiler have a notion of its own "classpath" that is separate from the normal compile-time classpath? Does a GWT app (and its internal workings) have the notion of its own classpath that is separate from the normal JRE runtime classpath? 回答1: GWT has the notion of modules. Each module does declare what packages are in its source path. Modules can extend other modules. Every Class the GWT compiles has to be in the source path of one module your main module extends from. The

JAXB 2 in an Oracle 10g Webapp

丶灬走出姿态 提交于 2019-12-23 18:20:02
问题 I have a web application that uses JAXB 2. When deployed on an Oracle 10g Application Server, I get errors as soon as I try to marshal an XML file. It turns out that Oracle includes JAXB 1 in a jar sneakily renamed "xml.jar". How I can force my webapp to use the version of the jaxb jars that I deployed in WEB-INF/lib over that which Oracle has forced into the classpath, ideally through configuration rather than having to mess about with classloaders in my code? 回答1: I assume you use the

Jar dependency - Application server classpath vs adding it to the application war itself

眉间皱痕 提交于 2019-12-23 18:08:49
问题 We have an installation of Weblogic 10.3.6. An application running on it needs the following jar com.oracle.ws.http_client_1.3.0.0.jar The above jar is located in the server bundle Oracle\Middleware\modules\com.oracle.ws.http_client_1.3.0.0.jar What's the right approach? Should this jar (appears to be a system library written by Oracle, not found on mvnrepository site) be added to the server classpath or should I add it to the application archive (war)?? Thanks. Update: Also the above jar