classpath

Java Classpath Issue

与世无争的帅哥 提交于 2019-12-20 07:14:45
问题 I have two classes: MyApplication Library The Library has already been compiled into Library.class and the source code is no longer available. I am now trying to compile MyApplication from source. MyApplication depends on the Library. The Library has a package name of org.myCompany. I tried setting my classpath to the following: set CLASSPATH=C:\java\project\org\myCompany\Library.class;. which produced the following javac compiler error message: MyApplication.java:33: cannot find symbol

How is NoClassDefFoundError thrown

蓝咒 提交于 2019-12-20 06:27:02
问题 I built a package called "com.hello" in eclipse and I wrote an easy HelloWorld program. Eclipse automatically added "package com.hello;" on top of my program. And HelloWorld.java was put in F:\workspace\helloWorld\src\com\hello; HelloWorld.class was put in F:\workspace\helloWorld\bin\com\hello. It worked very well in Eclipse. But when I entered the directory " F:\workspace\helloWorld\bin\com\hello " and used command line with "java HelloWorld," I got NoClassDefFoundError . I know it may have

Spring class loader issues in Jboss while using spring-ws client

风流意气都作罢 提交于 2019-12-20 04:51:27
问题 I have my application running properly in Jboss. To to write spring webservice client, i have generated classes using wsimport . I have written following in configuration <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> <property name="messageFactory"> <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/> </property> in jboss?lib i have jboss-jaxws.jar,spring.jar ...Now i copied spring-ws-1.5.0.jar and saaj-impl-1.3.jar but

Spring class loader issues in Jboss while using spring-ws client

懵懂的女人 提交于 2019-12-20 04:50:59
问题 I have my application running properly in Jboss. To to write spring webservice client, i have generated classes using wsimport . I have written following in configuration <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> <property name="messageFactory"> <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/> </property> in jboss?lib i have jboss-jaxws.jar,spring.jar ...Now i copied spring-ws-1.5.0.jar and saaj-impl-1.3.jar but

Does system classloader load all classes in classpath even if they're not actually used?

荒凉一梦 提交于 2019-12-20 02:54:45
问题 I'm using JDK 1.6 to run a small application. However I set a very massive classpath which includes a lot of classes. When I run the application will all classes in the classloader been loaded even if they're not actually used in my application? If not, how to force the classloader do so, and if yes, how to avoid it? Thanks! E.g.,I'm using ant 1.7 to run my application. Best Regards, Robert Ji 回答1: No, The ClassLoader loads the class when the class is needed in memory. It doesn't load all

Java class.getResourceAsStream() returns incorrect byte

风流意气都作罢 提交于 2019-12-20 02:39:09
问题 I have just run into a very strange problem with getResourceAsStream(). In my prod project JUnit test I read test data using getResourceAsStream(), I found that getResourceAsStream() sometimes substitutes some bytes: byte[] fileBytes = FileUtils.readFileToByteArray(new File( "resources/test/parser/test-short-enc.xml")); printBytes(fileBytes); byte[] classPathBytes = IOUtils.toByteArray(ParserTest.class .getResourceAsStream("/test/parser/test-short-enc.xml")) printBytes(classPathBytes); In

Jetty Maven plugin - Put properties file in classpath

无人久伴 提交于 2019-12-20 01:48:05
问题 I'm using the eclipse jetty plugin in my project: <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.0.3.v20130506</version> I have my application that read a file in the classpath of the server, but I can't manage to put it in the Jetty classpath... I would to put it in a folder in my project and make that folder part of the Jetty classpath, how can I do it? Is there a better solution to make that file external to the application? 回答1: It was just a

Maven Archiver putting in weird line breaks in classpath for manifest

只愿长相守 提交于 2019-12-19 16:55:16
问题 Per the java spec the classpath line in the manifest.mf for a jar can only be a certain number of bytes. After that a line break is inserted and the new line begins with an empty space. Using Maven 3, and maven-jar-plugin version 2.3.2 my manifest ends up with some interesting line breaks in the classpath and I think that may be breaking my EAR when deployed into WAS 7. Just want to make sure the manifest is OK to look like that (may not match byte length but so you get the picture): Class

Does java -jar option alter classpath options

别说谁变了你拦得住时间么 提交于 2019-12-19 07:26:29
问题 I have a jar file which mentions the main class in the manifest. When I try to execute the jar using the following command java -cp .;./* com.foo.MainClass The code executes and works. When I try to execute the jar using the following command java -cp .;./* -jar myjar.jar I get class not found execptions for some jars which are in the same folder as myjar.jar. I hoping that the -cp option will include those jars in class path. I modified my code to print java.class.path property. In the first

How to set CLASSPATH in Linux to let java find jar file?

大兔子大兔子 提交于 2019-12-19 04:57:15
问题 Under Linux I am trying to run a jar file as follows: java -jar plantuml.jar -testdot while having CLASSPATH set to any of the following (the file is located at /home/user/plantuml.jar ): export CLASSPATH=/home/user export CLASSPATH=/home/user/ export CLASSPATH=/home/user/plantuml.jar In either case, no matter how I define CLASSPATH , the java command gives an error Unable to access jarfile plantuml.jar . What am I doing wrong here? 回答1: You have to supply the complete path after the