java

Java to batch file

try { String comd ="E:/ior1.txt"; Runtime rt = Runtime.getRuntime(); rt.exec("C:/tes1.bat"+comd+""); System.out.println("Process exitValue: "); } catch (Exception e) { System.out.println("Unexpected exception Trying to Execute Job: " +e); } But when I run I get an exception like this Unexpected exceptio...

Easy pagination in Java EE with jsp

I'm looking open source pagination component, where I could just give list of items to method that would make pagination to my jsp page. I would get items from database by page parameter and pagination method would do the rest. Is there any good componenets for that ? ...

Servlets and AJAX communication

hi there, i do have a communication probleme here between my java servlet and an ajax request. more about it: Absolute path to the index.html (including javascript/ajax request): http://localhost:9080/chat/index.html In the same folder the servlet: MyChat.class And the Request is working like this: var url = "http://localhost:9080/...

how to create customized marshalled output from JAXB??

I don't want to use XML file created by JAXB marshaller, can I customize it, so that i would give a preferrable format to marshal objects? ...

best way to get value from Collection by index

What is the best way to get value from java.util.Collection by index? Thanks. ...

Java- How to Display record count

i would like to display the records retrieved after a query in the following format 'Record 1 of 20' I have the rownum and the total records retrieved. It is just the displaying that i need to know. It will be great if it could be displayed in a JLabel. thanks ...

Grails belongsTo, should I ?

Hi, let's go straight to the problems (with Grails 1.1.1, it should work on previous one) I have 2 domains ie: User and Detail like this : Class User { String userName ; ..... // another fields static hasMany = [details:Detail]; } Class Detail{ String detailName ; ... // another fields static belongsTo = [user:Use...

How do I make this regex more general, sometimes it works and sometimes it doesn't

I have the following regex that I am using in a java application. Sometimes it works correctly and sometimes it doesn't. <!-- <editable name=(\".*\")?> -->(.*)<!-- </editable> --> Sometimes I will have whitespace before/after it, sometimes there will be text. The same goes for the region within the tags. The main problem is that name...

JCIFS NTLM Authentication for HTTP Connections on GlassFish (or any servlet container)

I've created a Java class that connects to an IIS website requiring NTLM authentication. The Java class uses the JCIFS library and is based on the following example: Config.registerSmbURLHandler(); Config.setProperty("jcifs.smb.client.domain", domain); Config.setProperty("jcifs.smb.client.username", user); Config.setProperty("jcifs.smb....

Get height of multi line text with fixed width to make dialog resize properly

I want to create a dialog that contains some kind of text element (JLabel/JTextArea etc) that is multi lined and wrap the words. I want the dialog to be of a fixed width but adapt the height depending on how big the text is. I have this code: import static javax.swing.GroupLayout.DEFAULT_SIZE; import java.awt.event.ActionEvent; import ...

How to cache information in a DAO in a threadsafe manner

I often need to implement DAO's for some reference data that doesn't change very often. I sometimes cache this in collection field on the DAO - so that it is only loaded once and explicitly updated when required. However this brings in many concurrency issues - what if another thread attempts to access the data while it is loading or b...

hibernate restrictions and/or order

Hi, small questions about Restrictions.or and Restrictions.and If I do something like this: ... criterion = criterionA; criterion = Restrictions.and(criterion, criterionB); criterion = Restrictions.or(criterion, criterionC); criterion = Restrictions.and(criterion, criterionD); Will this be treated as: (A and B) or (C and D) (follow...

Icons between text in a jlabel using graphics

Hi how to paint multiple icons (ie., say icons between text) in jlabel using graphics? plz do assist me in this effort Thanks ...

Eclipse j2ee and bundled web tool platform confuses me

Hello good fellas i'm sure everybody is cool.I'm about to start a tutorial about jsp and jsf and the required tool is eclipse for j2ee and web tool platform.I'm a bit confused about where to find it bundled with wtp? and in which distribution is it Europa , Galileo or Ganymede ?.i know that it's here in entreprise java because it's cle...

Self modifying code in JAVA

Have you ever created or encountered a self modifying code in Java? If yes, then please post the link or simply post the code. ...

Accessing Windows system variables in Java 1.4

What is the best/foolproof way to get the values of environment variables in Windows when using J2SE 1.4 ? ...

When do we get java.lang.NoSuchMethodError even when the jar/class has the particualar method

I am using IText library to facilitate pdf export in an applet. During the export call it fails with following error java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfPTable.completeRow()V I opened the Itext jar/PdfPtable.class in JD Decompiler and confirmed that the class has completeRow as a public method. Can somebody explain th...

Is there any game engine in Scala?

I wonder if there are any game engine written in Scala or easily accesible from Scala? ...

Swing: How could I get JInternalFrame treated equally to other components inside a container?

Hello! Background information: I am implementing a visual diagram editor, which consists of different complex elements (re-sizable, with title bar, sub-elements) and different simple elements (not re-sizable, no title bar, no sub-elements). All elements are draggable. I am using JInternalFrame (for complex elements) along with JPa...

SQLite and J2ME

is it possible to use SQLite for a j2me application ? has anyone ever tried to do so ? ...