java

How to speed up Java VM (JVM) startup time?

I am running tests that start multiple JVM processes. Summary startup time of JVMs is quite significant compared to time of actual tests that run inside JVM. How do I speed things up? I have used "-client" option already, this does help but not as much as I wanted. Is there any other way, say preloading bunch of JVMs and reusing them so...

Variable parameter class?

The following code public static void main(String[] args) { fun(new Integer(1)); } static void fun(Object ... a) { System.out.println(a.getClass()); } gives the output :- class [Ljava.lang.Object; What class is this? ...

notification about new subscriber joining to jms topic

is it possible to get kind of notification on the message producer side, that new subscriber joined to the topic? In particular, is it possible with JBoss Messaging? ...

Java as a digital forensics environment

Hi folks, Just wondering if anyone out there has any experiance working with java (as appose to c/c++) in a digital forensics environment and if so could they advise me as to problems or advantages they may have encountered? Cheers ...

Starting an axis2 service programmatically

Hi, I'm programmatically starting a service in Axis 2 (1.5), like this: ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); AxisConfiguration cfg = context.getAxisConfiguration(); Map<String, MessageReceiver> mrMap = new HashMap<String, MessageReceiver>(); mrMap.put("http://...

Specifying Java path for properties file

I have a Java Spring project, configured with Maven. As the amount of unit tests and their configuration files is adding up rapidly, I'm trying to centralize the test configurations to one properties file (the same one, which is used in building the project). The unit tests are located (relative to the project path, of course) in tree s...

Any concept of shared memory in Java

AFAIK, memory in Java is based on heap from which the memory is allotted to objects dynamically and there is no concept of shared memory. If there is no concept of shared memory, then the communication between Java programs should be time consuming. In C where inter-process communication is quicker via shared memory compared to other mo...

itextsharp pdfpcell header

Hi, I'd like to have a table of cells of class PdfPCell each with a tiny header, main string and tiny footer. I can't find a way to insert them since HeaderandFooter is not allowed element to add to the cell, one paragraph overwrites another and so on. Any ideas? Thanks in advance ...

Creating tar archive with national characters in Java

Hi, Do you know some library/way in Java to generate tar archive with file names in proper windows national codepage ( for example cp1250 ). I tried with Java tar, example code: final TarEntry entry = new TarEntry( files[i] ); String filename = files[i].getPath().replaceAll( baseDir, "" ); entry.setName( new String( filename.getBytes...

checking an access file via java and mailing for a specific row

Hello I need to write a program that checks a access .mdb file and when a specific row is added (say the "name" field column of the newly added a row that contains a specific string, it should send an email to a specific address. For this I am planning to use "Jackcess" library for reading the mdb file and "Apache's commons-email libra...

How to create an executable jar with dependancy jars

Hi I have created a java application which depends upon some external jars. Now I want to create an executable jar for my project. Means if i double click the project then it should execute. Thanks Sunil Kumar Sahoo ...

ThreadLocal implementation

With reference to my earlier question, going a bit further, What are the disadvantages of using ThreadLocals as opposed to local variables How are they implemented Are session variables ThreadLocals Are there more examples of ThreadLocals used frequently ...

Read RSAPublicKey in Java from XML file

How to read RSA Public Key in Java from xml file? This is file format. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <RSAKeyValue> <Modulus>jWa96uXeSM6hUH0E/ueihtuowdte8</Modulus> <Exponent>BAAQ</Exponent> </RSAKeyValue> ...

how to execute a piece of code only after all threads are done

Hi, I have a logging code which needs to be executed after all threads are executed. Thread t1 = new MyThread(); Thread t2 = new MyThread(); t1.run(); t2.run(); doLogging(); Is there any way to execute doLogging() only after both threads are done with their processing. Now that doLogging() is called as soon as t1, t2 are started. ...

Unit Testing an EJB

I'm looking for a way to apply TDD to Session Beans. can anyone provide advices and links on how to unit test them ? how to use JUnit to do so ? P.S : I'm new to Test Driven Development and Session Beans. I'm using EJB v2. ...

How can I find out the amount of open sessions programatically in Tomcat using Java?

Is it possible to find out the number of open sessions reliably in Tomcat (i.e. not only the amount of users who have logged in since [current time]-[session time out], but the number of sessions stored on the server)? ...

How to make a columns in JTable Invisible for Swing Java

Hello, I have designed one GUI in which I have used one JTable from which I have to make 2 columns invisible . How should I do that ? ...

Duplicating a Jtree

I need to create a copy of an already existing tree , created using DefaultMutableTreeNode.[Edit] So, I have tried to assign the existing root node, to another DefaultMutableTreeNode.Ex: DefaultMutableTreeNode ABC = new DefaultMutableTreeNode(null); DefaultMutableTreeNode ABCcopy = new DefaultMutableTreeNode(null); ABCcopy=ABC; But th...

In Java, when should I use an abstract method in an interface?

I have the following interface in Java public interface IFoo { public abstract void foo(); public void bar(); } What is the difference between foo() and bar()? When should I use abstract? Both seem to accomplish what I want unless I'm missing something subtle? Update Duplicate of Why would one declare a Java interface method...

Java+DOM: How do I set the base namespace of an (already created) Document?

Hello! I am dealing with an already created Document object. I have to be able to set it's base namespace (attribute name "xmlns") to certain value. My input is DOM and is something like: <root>...some content...</root> What I need is DOM which is something like: <root xmlns="myNamespace">...some content...</root> That's it. Easy,...