java

stax to DOM converter

I want to read DOM document using Stax stream readers and write it using Stax stream writers. I want to modify xml file and change some element values I want the cursor to point at a certain element in xml file befor building dom tree I wrote this code but the xml file did not modified can anybody help me ? FileInputStream input = new ...

Trouble converting SQL Query into JPQL (Eclipselink)

Hey guys, I have the following query and for the life of me I can't seem to translate it into JPQL. The working SQL is: select * from TB_PRINT_DETAIL y inner join (select JOB_ID,max(COPY_NUM) MAX_COPY_NUM from TB_PRINT_DETAIL group by JOB_ID ) x on y.JOB_ID = x.JOB_ID and y.COPY_NUM = x.MAX_COPY_NUM My feeble attempt at translati...

What are the unit testing frameworks available in java?

What are the technologies out there? (I only know of JUnit) What is the most popular? Can you please explain the pros/cons of each? Thanks Alot!! ...

Null pointer exception on Execute

I am new to Java (coming from c#) and I am trying to figure out the problem with this code. It should just be inserting a record into a SQL Server database. try { getConnection(true); cstmt = conn.prepareCall("{ call dbo.usp_insert_LeadSubmissionDistributor(?, ?, ?, ?, ?, ?, ?) }"); if (distRepName == null) { c...

Can we specify a specific user settings.xml to use via pom.xml ?

Hi, I would like to know if someone found a trick to specify a settings.xml file in a (parent) pom.xml. The goal is to avoid every developer to have their own -possibly "customize"- version of those settings. Instead it would be set on a central location on the corporate network. I'm aware of the "-s" that works on the command-line, b...

From Java to JavaScript

Hello everyone, I briefly checked for dupes of this question, since I was certain they would exist, but I couldn't find any! So, I am going from Java to JavaScript; what can I read that will make sense? (and if I just have to forget everything about Java and start over, that's fine too.) ...

Error deploying MDB with multiple queue names in OpenEJB

The following error appeared at Tomcat/OpenEJB startup after upgrading to OpenEJB 3.1.3: ERROR - Unable to register MBean java.lang.IllegalStateException: javax.management.MalformedObjectNameException: Invalid character ',' in key part of property at org.apache.openejb.monitoring.ObjectNameBuilder.build(ObjectNameBuilder.java:59) ...

Java String Manipulating HTML Tags

I have a java string with some text and html: <title>test title</title> blabla bla more text What I am trying to achieve is two-fold: 1) Retrieve the content of <title></title> and save it in a separate string. 2) Remove that part of the original string: <title>test title</title> So the end result would be something like originalS...

How to induce blinks on JTextField labels continously?

Little background: I have a JTextField called reading. It is located on a JFrame panel. reading = new JTextField("waiting for entry"); What I am trying to do is amend the JTextField to where it creates a blinking effect. Appears, and then disappears. I want that to alert the user that it needs attention. So is there a way where I a...

Anyway to Boost java JVM Startup Speed?

Hello SO Well , it is said that Java is 10x faster than python in terms of performance, thats what i see from benchmarks too. But what really brings down java is its startup time of JVM which is quite stupid. This is a test i made: $time xlsx2csv.py Types\ of\ ESI\ v2.doc-emb-Package-9 ... <output skipped> real 0m0.085s user 0m...

Which one to choose - Android 1.5 or Android 2.2? (I am a beginner)

Hi, I want to start programming in Android. I have backgrounds in Java and j2me. As I am new and have budget constraints I was willing to purchase HTC G1 (1.5 cupcake) rather than any 2.2 device. Is that a good idea? (or let me know if there is any lowcost (around $200) 2.2 device) Please give your opinion. Thanks ...

Creating R data frames and .rdata files from Java

What is the most memory efficient and easiest (yes, I know those are sometimes mutually exclusive) way to create an R data frame then save it to an .Rdata file using Java? Go easy on me though, I'm not a Java developer. ...

What Jersey doesn't like in my Stateless Session Bean?

This is my SLSB: @Stateless(name = "FinderEJB") @Path("/") public class Finder implements FinderLocal { @Path("/simple") @GET public String simple() { return "works"; } } The interface is: @Local public interface FinderLocal { public String simple(); } This is what I'm getting in Glassfish server log when I'm trying t...

Why am I getting a NoClassDefFoundError?

Could anybody tell me why I'm getting this error, and how to fix the problem? Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/stax2/ri/Stax2ReaderAdapter at org.codehaus.staxmate.dom.DOMConverter._build(DOMConverter.java:188) at org.codehaus.staxmate.dom.DOMConverter.buildDocument(DOMConver...

JAXB annotations to deal with same element name in different namespaces.

The problem that I am trying to solve is that JAXB cannot handle the parent and inherited objects of the same name in different namespaces. I have two schemas: schemaA.xsd <xs:schema xmlns:A="..."> <xs:complexType name="mytype"> ... schemaB.xsd <xs:schema xmlns:B="..." xmlns:A="..."> <xs:import namespace="..." schemaLocation="schem...

Java EE E-Commerce Frameworks

What are the Java EE frameworks for developing e-commerce applications? Thanks ...

How can my Java program store files inside of its .jar file?

I know that .jar files are basically archives as well as being applications. What I'm asking is how can I store data(actual files not just strings) packed inside my program? I want to do this within my Java code. The reason for this if your wondering is that I'm producing a server mod of a game. The server starts and creates all the lev...

Java Regex/run on groovy: how to extract all the captured blocks?

Hi, I'm trying to extract two blocks of code from a text file using Java regex. However, I can only extract the last block. Could some one point out what is is wrong with mycode? thanks. here it is import java.util.regex.*; INPUT_START_OR_BLANK_LINE = /(?:\A|\n\n)/ FOUR_SPACES_OR_TAB = /(?:[ ]{4}|\t)/ CODE = /.*\n+/ CODE_LINES = /(...

Little glitch in implementing RSA algorithm

I am trying to implement the RSA algorithm, but for some reason my code below doesn't produce correct results (note that only the relevant code is shown). BigInteger n = p.multiply(q); BigInteger totient = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE)); Random rand = new Random(); BigInteger e; do { e = new BigInteg...

JPA 2 (EclipseLink) Trying to use UUID as primary key EntityManager.find() always throws exception (Database is PostgreSQL)

I'm trying to use a UUID for a primary key using JPA 2 (EclipseLink). I'm using PostgreSQL as the database. I have my entity declared as follows: I have an Employee table with its PK set as a UUID. I have a JPA Entity mapping to the employee table, which looks like this: @Entity public class Employee { @Id private String id; ...