classloader

Why Does Clojure Use the Context Classloader by Default?

时光总嘲笑我的痴心妄想 提交于 2019-12-18 12:53:03
问题 Why is use-context-classloader set to true by default? Why doesn't Clojure use the current class loader? 回答1: you can override its behavior by setting clojure.lang.Compiler.LOADER to the class loader ie. final ClassLoader ccl= ClojurePlugin.class.getClassLoader(); clojure.lang.Var.pushThreadBindings(clojure.lang.RT.map( clojure.lang.Compiler.LOADER, ccl) ); try { ... clojure.lang.RT.loadResourceScript( cljFile ); ... }finally{ clojure.lang.RT.popThreadBindings(); } where ClojurePlugin is your

Java WebStart slow, requesting libraries from invalid folder

跟風遠走 提交于 2019-12-18 09:02:28
问题 Problem and question: Java webstarted app looking for its classes in base folder instead of ./lib. As suggested in similar question at Java Web Start applications ask repeatedly for un-existing files I have turned off the jar signing, to rule out the security issue, and the problem persists. Below find the clean example on what is going over the network for this simple java program: public static void main(String[] args) { // TODO code application logic here System.out.println("Hello World!

java.lang.NoClassDefFoundError: org/dom4j/Document

筅森魡賤 提交于 2019-12-18 08:26:33
问题 I have a class called XMLtoXML.java and this is one of it's methods... import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; public Object[] process(Object data) { String templateXML = null; Object result[] = null; String inputxml = null; String templateNumber = null; Iterator iterator = null; String scenarioConfigUrl = null; Node inputNode; Node outputNode; String subTemplateXML = null; String outputXml =

Stock JDK classes and the “null” ClassLoader?

不打扰是莪最后的温柔 提交于 2019-12-18 07:42:52
问题 Hi guys : Im trying to debug a very strange class error by looking at the ClassLoader s for some dynamically created components. ClassLoader s are something I've never played much with - and im surprised that standard JDK classes have null Class loader instances. Can somebody explain the output of this simple main method in terms of the classes whose loaders I am attempting to print , and also more generally - the way ClassLoader s work on the JVM and how we can debug missing classes using

Java: How to load a class (and its inner classes) that is already on the class path?

怎甘沉沦 提交于 2019-12-18 06:02:21
问题 How can I load a class that is already on the class path, instantiate it, and also instantiate any inner classes defined within it? EG: public class TestClass { public class InnerClass { } } 回答1: Inner classes cannot exist outside the parent class. You need to construct the parent class first. Without reflection this would look like: InnerClass innerClass = new TestClass().new InnerClass(); In reflection, you need to pass the parent class in during construction of the inner class. Object

Java: Load class from string

早过忘川 提交于 2019-12-18 05:24:11
问题 I know this has probably something to do with class loaders, however I couldn't find an example (it might be I'm google-ing for the wrong keywords. I am trying to load a class (or a method) form a string. The string doesn't contain the name of a class, but the code for a class, e.g. class MyClass implements IMath { public int add(int x, int y) { return x + y; } } and then do something like this: String s = "class MyClass implements IMath { public int add(int x, int y) { return x + y; }}";

JBoss Scoped Class Loading

坚强是说给别人听的谎言 提交于 2019-12-18 04:27:11
问题 I want to use the latest hibernate version inside the ear without upgrading the jars on the server. I am following the instructions given here - http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html. However the problem now is the application is not taking the jboss-local-jdbc.rar sitting in the deploy folder. 2009-07-21 09:01:50,347 INFO [org.jboss.system.ServiceConfigurator] Problem configuring service jboss.jca:service=DataSourceBinding,name=MockDS org.jboss

When is a Java Class loaded?

让人想犯罪 __ 提交于 2019-12-18 04:07:57
问题 I searched the internet for more than couple of hours and could not reach any conclusion. Recently I decided to use BouncyCastle for SSL but I wanted it to off by default, so that BouncyCastle jar may not be in the class path. private void enableBouncyCastleForSSL() { if (config.isBouncyCastleEnabled()) { Security.insertProviderAt(new BouncyCastleProvider(), 1); } } Even when config is disabled, it was looking for BouncyCastle and it failed with class loader error. java.lang

Does jvm load all the classes mentioned by the classpath?

十年热恋 提交于 2019-12-18 03:35:12
问题 When we invoke java command with -cp command then we provide some directories and jar files. Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required? 回答1: Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required? JVM loads classes form the classpath on the need basis i.e. when a reference is found for the class, it is

How to prevent xalan.jar that has META-INF\services\javax.xml.transform.TransformerFactory from taking over JDK 1.6 built in Xalan implementation?

耗尽温柔 提交于 2019-12-17 19:53:35
问题 Consider this code (based entirely on flying saucer's "getting started" code, their rights reserved): package flyingsaucerpdf; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import org.xhtmlrenderer.pdf.ITextRenderer; public class PDFMaker { public static void main(String[] args) throws Exception { new PDFMaker().go(); } public void go() throws Exception { String inputFile = "sample.html"; String url = new File(inputFile).toURI().toURL().toString(); String