When I use the annotation:
@XmlRootElement(name="RootElement", namespace="namespace")
class RootElement {
to create xml file from java, it creates the root element as:
<ns2:RootElement xmlns:ns2="namespace">
but I wanted to create without the "ns2", like:
<RootElement xmlns="namespace">
Any idea how to fix it?
Reletad link (example I used to create the xml):
http://www.java2s.com/Code/JavaAPI/javax.xml.bind.annotation/XmlRootElementname.htm
How do I backup / restore any kind of databases inside my java application to flate files.Are there any tools framework available to backup database to flat file like CSV, XML, or secure encrypted file, or restore from csv or xml files to databases, it should be also capable of dumping table vise restore and backup also.
Java's jar file format builds off of the zip file format, and supports compression of the class files inside it. When and how does the JVM decide which class files to uncompress and pull out of the jars on its classpath? Is the process dynamic and done at runtime as classes are needed, or are they all uncompressed up front before the program actually runs?
Hi,
I have an application that passes in java.util.Date. I want to check whether this date is within a specified time of day (e.g. between 10:30 & 11:30), I don't care about the date, just the time of day.
Can anyone show me a simple way to do this?
Thanks
From what time I've spent with threads in Java, I've found these two ways to write threads.
public class ThreadA implements Runnable {
public void run() {
//Code
}
}
//with a "new Thread(threadA).start()" call
public class ThreadB extends Thread {
public ThreadB() {
super("ThreadB");
}
public void run() {
//Code
}
}
//with a "threadB.start()" call
Is there any significant difference in these two blocks of code?
I am basically a web application developer, never in my career got a chance of trying out this.. can someone explain the whys and the wherefores for using Native code in java? Thanks a Ton in advance!
I need encrypt data using exactly the PKCS#1 V2.0 encryption method (defined in item 7.2.1 of the PKCS#1V2 specification).
Is it already implemented for Java?
I'm thinking in something like just pass a parameter to javax.crypto.Cipher specifying "PKCS#1V2", I wonder if there is something like this?
I have a closed source Java application for which vendor has provided APIs for customization. As I have no other documents, i rely completely on the API's javadoc.
I want to trace what methods are actually called in different classes for a particular use case. Is there any way to do that with eclipse?
Does anyone know of an existing Java component that implements a TokenField, similar to Cocoa's NSTokenField?
An overview of the Cocoa control is at:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TokenField%5FGuide/Introduction/Introduction.html
Suggestions for implementation?
Thanks!
I anticipate using some images in my Java application. These images will be drawn onto my JPanel using g.drawImage(). The JPanel is resizable and the images should scale as the JPanel increases/decreases in size
Two questions:
What image format is best for this type of desired scalable image? For instance, in this application, an image of size 100x100 may be scaled into an image of size 30x30 or 10x10 or 300x300.
How can I write code to do this scaling?
hi friends,
How to read XML file into two dimensional array using java. Am new to this concept. Please suggest me any ideas and suggest any websites and examples regarding this question.
Just seeking some advice. By profession I am primarily a front-end programmer working with ajax technologies (currently I use php as my backend language of choice). As of lately I've been looking at Java as a very good OOP language to learn and just wanted to know if you guys have any advice as to what's the best way to learn the language and achieve proficency that may some day lead to mastery.
I have a hexadecimal string "41464353". I want to convert it into bytes. I know the value of this hex string in byte will be "65706783". I want this as answer. Please give me a program for this in Java.
I am interested in understanding object-oriented programming in a more academic and abstract way than I currently do, and want to know if there are any object-oriented concepts Java and C++ fail to implement.
I realise neither of the languages are "pure" OO, but I am interested in what (if anything) they lack, not what they have extra.
Possible Duplicate:
How will I know when to create an interface?
Why do we need interfaces in Java?
Instead of interface can't we write the methods directly in the class itself?
Why do we need a separate interface?
There is any concept of inline function or its replaced by some other things in java..if yes then how we use it..because i'v heard that public, static and final methods are the inline function.can we create our own inline function?
I would like to split my strings in JAVA based on a regular interval, not on regex. This is what I have to split:
1 x3.1.105.41 1 -10
2 x4.1.105.41 0 -10
3 x12.1.105.41 0 -10
4 y3.1.105.41.19 1 0
5 y4.1.105.41.21 0 0
6 y1.1.105.41.23 0 0
7 y12.1.105.41.25 0 0
I would like to seperate each column. Currently, I use the strLine.spli function
Any help would be great!
What would be the least-slow thread-safe mechanism for controlling multiple accesses to a collection in Java?
I am adding objects to the top of a collection and i am very unsure what would be the best performing collection. Would it be a vector or a queue? I originally thought an ArrayList would be fast but i ran some experiments and it was very slow.
EDIT: In my insertion testing a Vector delared using volatile seems to be the fastest?
Using Java have the source code of a webpage stored in a string. I want to extract all the urls in the source code and output them. I am awful with regex and the like and have no idea how to even approach this. Any help would be greatly appreciated.
I'm looking for a Java library that is geared towards network math and already tested. Nothing particularly fancy, just something to hold ips and subnets, and do things like print a subnet mask or calculate whether an IP is within a given subnet.
Should I roll my own, or is there already a robust library for this?
Is it possible to reliably determine the compilation time stamp of a given class for both java applications running locally and as applets and/or JNLP webapps ?
Maybe the title is not appropriate but I couldn't think of any other at this moment. My question is what is the difference between LinkedList and ArrayList or HashMap and THashMap .
Is there a tree structure already for Java(ex:AVL,Black-white) or balanced or not balanced(linked list). If this kind of question is not appropriate for SO please let me know I will delete it. thank you
Hello,
I am writing a piece of code in which i have to find only complete words for example if i have
String str = "today is tuesday";
and i am searching for "t" then i should not find any word.
Can anybody tell how can i write such a program in java?