java

How to execute application continuously without hangs device in blackberry.

Hi, I have created an application of contacts synchronization. when i run it on device it hangs my device while synchronizing then i am not able to open another application, I am also doing auto synchonization with in a perticular period of time. I want that synchronization should be perform without hang to device and if i get any in...

utf-8 decoding in java

I'm trying to pass parameters from a PHP middle tier to a java backend that understands J2EE. I'm writing the controller code in Groovy. In there, I'm trying to decode some parameter that will likely contain international characters. I am really puzzled by the results of my debugging this problem so far, hence I wanted to share it with ...

Java / Eclipse : How does Eclipse compile classes with only a JRE ?

I need to batch a compilation with a special JRE which has been "customized". Eclipse is able to compile the classes with this JRE, but I need to make a build script outside of Eclipse. What is the method used by Eclipse to generate the .class files without a JDK ? ...

static variable initialization java

how to initialize a private static member of a class in java. trying the following: public class A { private static B b = null; public A() { if (b == null) b = new B(); } void f1() { b.func(); } } but on creating a second object of the class A and then calling f1(), i get a null pointer except...

Java: Is there any simpler way to parse array elements from string?

Hi, In the application there is a string in the following format: String elements = "[11, john,][23, Adam,][88, Angie,]..." (... means there are more elements in the string) From the given string I have to create an ArrayList for name IDs (11, 23, 88, ...) and ArrayList for names (john, Adam, Angie, ...) I created two methods: priv...

java classloader and runtime compilation

Hi all, Despite warnings to drop my present course of action, I currently see no better way to solve my problem. I must generate Java code at runtime, then compile it, load it and reference it. Problem is that the generated code imports code that has already been loaded by the system class loader (I suppose) - that is, code present in ...

Maven embedded Tomcat version

Is there a way to control the Maven embedded Tomcat version? mvn tomcat:run This command will run a Tomcat 6.0.16 instance. I'd like to run a 5.5 version of Tomcat. Is there a way to configure this? Searching the plugin docs didn't help... Thanks! ...

Changing the background color of a paragraph in JTextPane (Java Swing)

Is it possible to change the background color of a paragraph in Java Swing? I tried to set it using the setParagraphAttributes method (code below) but doesn't seem to work. StyledDocument doc = textPanel.getStyledDocument(); Style style = textPanel.addStyle("Hightlight background", null); StyleConstants.setBackground(style, ...

What to do with 3rd party Javadoc

Looking to see what others do with 3rd party (vendor) java documents? Do they get placed under source control so everyone can have access to them? Placed out on a local shared directory? other solutions that people have to work well. We use clearcase and have developers spread out through the US along with a couple of off shore groups...

strange java socket problem on windows

I've a strange problem with a java server application running on a windows machine; sometimes the SocketChannel I just obtained by ServerSocketChannel.accept immediately returns an error when I try to read data from it - the strange thing is that at the same time the client that started the incoming connection is stuck waiting for the an...

Return same view controller using ModelAndView of Spring Web MVC

I am using Spring Web MVC and Hibernate for developing my application. My login.jsp page has following code : <form:form method="post" commandName="User"> User Name : <form:input path="email"/> Password : <form:input path="password"/> <input type="submit" align="center" value="Execute"> Now, My servlet.xml file ha...

Escape char problem while generating JavaScript page through Java code?

I am generating JavaScript pages through Java code like: FileOutputStream fs=new FileOutputStream("C:\\Documents and Settings\\prajakta\\Desktop\\searcheng.html"); OutputStreamWriter out=new OutputStreamWriter(fs); out.write("<script language='JavaScript' type='text/javascript'>"); out.write("var str=new String('C:\\Documents and Setti...

Converting XML or HTML to Wiki mark up - what approach would you choose?

I need to convert HTML documents (generated from DocBook XML documents) to the Wiki mark up language, in particular to the PM Wiki mark up language. The goal is to include the company's application operations guides in our newly created wiki. This means that I actually have two options: Convert the HTMLs (generated from DocBook XMLs) t...

Writing unicode characters with Batik doesn't work

Hi, I am writing a project with Batik, which is for multi-language image. Therefore I need signs like "sigma" or "alpha". I have to write the character as text - not as a polygon or as a glyph - because it has to be written by my project again. If I write a unicode character in my SVGDocument it is shown correctly in the debugger, but ...

Generics and anonymous classes (bug or feature?)

Hi. This code not compiles, because of 'A' expression. It's interesting thing: in A expression expected List<Foo> generic type, but got List<anonymous Foo> (according compiler). Is it a jdk bug or feature? interface Foo{ void doFoo(); } public class GenericsTest { public static<V> List<V> bar(V v){ return new ArrayList<V>();} ...

how to use PageEvent in tapestry4 to sendRedirect to another page

public void pageValidate(PageEvent event) { //how to use pageEvent to sendRedirect to google.com ? ...

Is there a Java web framework that allows the user to create custom fields (like in Mantis bugtracker)?

Is there a Java web framework that allows the user to create custom fields, like in Mantis bugtracker? http://www.mantisbt.org/wiki/doku.php/mantisbt%3Afeatures Here's what I actually want to do: Allow the user to create a template / form that has several custom fields (textboxes, checkboxes, comboboxes, etc.) Once a template has be...

<a> tag problem while generating javascript through java code

How should I write a statement in Java to produce JavaScript in a page out.write("document.write('< a href='str'> '+str.slice(beg+1,end)+' </a>');"); so that it will create statement in JavaScript document.write("< a href=' "+str+" '> "+str.slice(beg+1,end)+" </a>"); //< a and the link will go to page whose address is stored in st...

In Java, what is the best way of continuing to call a function until no exception is thrown?

In my Java code, I have a function called getAngle() which sometimes throws a NoAngleException. Is the following code the best way of writing a function that keeps calling getAngle() until no exception is thrown? public int getAngleBlocking() { while(true) { int angle; try { angle = getAngle(); return ...

whats the difference between ".equals and =="

i switched lecturers today and he stated using a weird code too me. he says its better. when i asked why, he asnwered "because it is!" so much for that. so heres an example: if (o1.equals(o2)) { System.out.println("Both integer objects are the same"); } instead of what im used too: if (o1 == o2) { System.out.println("Both inte...