java

parsing/scanning/tokenizing "raw XML"

I have an application where I need to parse or tokenize XML and preserve the raw text (e.g. don't parse entities, don't convert whitespace in attributes, keep attribute order, etc.) in a Java program. I've spent several hours today trying to use StAX, SAX, XSLT, TagSoup, etc. before realizing that none of them do this. I can't afford to...

Should we store JRE in CVS/SVN?

I want to bundle JRE 6.0 together with my java application. All my source code reside in CVS. My client will check-out the code and build it themselves. Should I store JRE in CVS? ...

Maven dependency within dependency with different scope

Say I have a Maven dependency defined in a project like below. <dependency> <groupId>com.thoughtworks.xstream</groupId> <artifactId>xstream</artifactId> <version>1.3.1</version> <scope>test</scope> </dependency> <dependency> <groupId>mycompany.library</groupId> <artifactId>myli...

Is there a regular expression for finding/replacing the common start of all lines in a chunk of text?

Imagine this string: if(editorPart instanceof ITextEditor){ ITextEditor editor = (ITextEditor)editorPart; selection = (ITextSelection) editor.getSelectionProvider().getSelection(); }else if( editorPart instanceof MultiPageEditorPart){ //this would be the case for the XML editor selection = (ITextSelection) editorPart.getEditor...

Compile error when adding ActionListener to Array created GUI

I had a huge file for creating this GUI and I have shortened by using arrays. I am trying to add an ActionListener when the arrays are being added and I am getting this error /tmp/jc_3531/GUI.java:60: addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (GUI) nButtons[c].addActionList...

JVM instruction set CPU cycles & byte size

The Java Virtual Machine Instruction Set page provides information about mnemonics such as aaload, aastore... etc. However neither the cpu cycles that these mnemonics would take up is mentioned nor is there any info on the byte size or word size of these mnemonics. Any idea where this information could be found? ...

Hibernate Entity sort column configuration

Is there a Hibernate configuration (hopefully an annotation on a classes mapped @Column field) that would let me sort a collection of entities associated with the loaded entity by a given column of that entity when a session.load(Entity.class, Id) is called? For example if I had an EntityA that contained a OneToMany association to an En...

Java applet as stand-alone Windows application?

I have a Java applet that is meant to run only on Windows. (It uses a 3rd party COM object; it is not cross-platform.) Is there a way to run a Java applet as a stand-alone application on Windows? ...

[JAX-WS] How can I share classes between client and server?

I've created a jax-ws service endpoint and now I want to write a client. I want to have a shared jar between the client and server for common (JAXB annotated) entity classes and interfaces for the services. Is it possible to force jax-ws to generate (or allow me to write) a client using my existing entites/interfaces? For those that are...

Convert a JSON string to object in J2ME?

I've asked this before for Java, but this applies specifically to J2ME. Is there a way in J2ME to convert a string, such as: {"name":"MyNode", "width":200, "height":100} to an internal Object representation of the same, in one line of code? The problem with such JSON libraries, is that they generate JSONObjects from strings, not...

neko vm ? need to download like jvm?

i new to neko vm. may i know in order to use it, i need to download the vm and install on client's browser? it is the same like java vm right? what is the different from java applet using jvm? ...

linking methods from an enum to member variables of client class

Hello, The following enum structure performs certain operations while remaining agnostic to the client class (for encapsulation reasons) public enum MyEnum implements Commands{ A{ public int method1(int varY) { return varY+2; } public MyEnum method2(){ return MyEnum.B; ...

Not writing the int value.Pl correct the prg.

Hi All, pl correct the prg. Q. Write a java prg to accept RollNo, Name of a Student and store it in Student.txt.Accept n records and store it. Following are the drawbacks of o/p produced 1. When we write rno i.e. int {roll no of stud} to the file "Student.txt" it does not write the int value i/p C:\j2sdk1.4.1_01\bin>java StudentInfo...

What is it called when you use object... as a parameter?

I have noticed in Java that you can have a function with object... as a parameter and then method will take any number of objects as a parameter and treat it as an array. What is this called? I have been trying to search for it but it seems ... is ignored by search engines. I seem to remember printf in C does the same thing. Thanks. ...

Is there any API in java to access wikipedia data

PLz I want to know is there any API or a query interface through which I can access wikipedia data ...

3d Line graph in Java

Is there any good open source library in Java which can be used to draw 3D dynamic charts, like JFreeChart does it for 2D? ...

Java Transaction service

Hi all, I want to use Java Transaction service for distributed transaction management in my Java application. I have 3 different databases to which I have to connect using 3 different Connection objects. I want to insert certain data in each of the 3 databases. My requirement is that atomicity should be maintained. So either data should...

Handling Runtime dependencies

Dependency injection is a useful technique but what approach is recommended when faced with runtime dependencies? e.g. Say you want to glue an event to an event processor depending on the type of the event and the user who initiated the request. public interface Event {} public interface EventProcessor { public void handleEvent(Ev...

How to embeded 2 gwt module_x.module_x.nocache.js into a html file ?

Hi I write 2 GWT module and compile it. I want locate ***.nocache.js files into a html file. ...

JAXWS Interceptors

What are JAX WS Interceptors? Where do I find info regarding the same! ...