java

How to move only the current file with Eclipse and/or Ant?

I am working on a small team of web application developers. We edit JSPs in Eclipse on our own machines and then move them over to a shared application server to test the changes. I have an Ant script that will take ALL the JSPs on my machine and move them over to the application server, but will only overwrite JSPs if the ones on my m...

Developing Web services applications from existing WSDL files

Hello, I have done this on Websphere (re: title of this topic) using wsdl2java for generating wsdl to java mapping xml file. My endpoint is a generic stateless EJB. The code in EJB is generated by traversing the each wsdl and getting the wsdl operation and stuck it in the generated remote EJB interface. Each EJB method impl is generic an...

Launching a URL from an Eclipse plugin

I'd like to have my Eclipse plugin cause a URL to be opened by the users' default browser. This seems like pretty standard behavior, but I haven't been able to find any docs on how to do this. Can anyone help? ...

Share file storage index with multiple open applications in Java

Hello. I'm writing an HTTP Cache library for Java, and I'm trying to use that library in the same application which is started twice. I want to be able to share the cache between those instances. What is the best solution for this? I also want to be able to write to that same storage, and it should be available for both instances. Now...

Calling Java (or python or perl) from a PHP script

Hi, I've been trying to build a simple prototype application in Django, and am reaching the point of giving up, sadly, as it's just too complicated (I know it would be worth it in the long-run, but I really just don't have enough time available -- I need something up and running in a few days). So, I'm now thinking of going with PHP ins...

Can I implement HttpSessionListener this way ?

I'm trying to tracking valid user Ids in my Java servlet, can I implement HttpSessionListener this way ? public class my_Servlet extends HttpServlet implements HttpSessionListener { String User_Id; static Vector<String> Valid_User_Id_Vector=new Vector<String>(); private static int activeSessions=0; public void sessionCreated(Ht...

Instantiating object of type parameter

I have got a template class as follows: class MyClass<T> { T field; public void myMethod() { field = new T(); // gives compiler error } } How do I create a new instance of T in my class? ...

Different answer when converting a Double to an Int - Java vs .Net

In C# if I want to convert a double (1.71472) to an int then I get the answer 2. If I do this in Java using intValue() method, I get 1 as the answer. Does Java round down on conversions? Why do the Java API docs have such scant information about their classes i.e. Returns the value of the specified number as an int. This may in...

Java concurrency scenario -- do I need synchronization or not?

Here's the deal. I have a hash map containing data I call "program codes", it lives in an object, like so: Class Metadata { private HashMap validProgramCodes; public HashMap getValidProgramCodes() { return validProgramCodes; } public void setValidProgramCodes(HashMap h) { validProgramCodes = h; } } I have lots and lots of...

Eclipse: Attach source/javadoc to a library via a local property

I have a third-party library in my SVN repository and I'd like to associate source/javadoc with it locally in Eclipse. I.e., there should be some local setting (for example, an entry in the local.properties file) that associates the source/javadoc with the JAR file, but which doesn't introduce local dependencies into the repository via ....

How to Send Encrypted Emails Programmatically (from an automated process)

I have a process that runs on a UNIX (Solaris) server that runs nightly and needs to be able to send out encrypted emails. I only need the "encryption" portion, NOT the digital signature / self-repudiation part of PKI. I use MS Outlook in a corporate setting and I am assuming that when a user clicks "Publish to GAL..." under Tools -> O...

Jasper report column width

Hi, I have some Jasper reports which are displayed in HTML format. I would like the width of the columns in the HTML tables to automatically resize to fit the content of the widest cell (in that column), such that all the data is displayed. Currently this does not happen because the HTML generated by Jasper specifies fixed widths for t...

How to get distinct results in hibernate with joins and row-based limiting (paging)?

I'm trying to implement paging using row-based limiting (for example: setFirstResult(5) and setMaxResults(10)) on a Hibernate Criteria query that has joins to other tables. Understandably, data is getting cut off randomly; and the reason for that is explained here. As a solution, the page suggests using a "second sql select" instead of...

How to launch a file protocol URL with an anchor from Java?

From a Java program, I need to launch the default browser on a local HTML file, pointed to an anchor inside the file. In Java SE 6, the java.awt.Desktop.browse method will open the file, but will not honor the anchor, so something like the following opens the file at the top, but does not page the browser to the anchor: Desktop.getDesk...

j2me service discovery and discoverable same time

Hi! I try to write a simple client/server application (all application is a bluetooth service and client). The client code find the bluetooth devices and register in to the local db. But when the inquiry running, it's not discoverable. (The server code run on another thread). I the emulator it's work (the scan time is 0), but when I ins...

ArrayList vs. Vectors in Java if thread safety isn't a concern

Is there really that much of a difference between the performance of Vectors and ArrayLists? Is it good practice to use ArrayLists at all times when thread safety isn't an issue? ...

Move / Copy File Operations in Java

Is there a standard Java library that handles common file operations such as moving/copying files/folders? ...

Sending email in Java

I have read that to send email in Java I need to obtain my ISP's SMTP address, but if I am intending to host my web app online, will this be my hosts ISP SMTP address? EDIT: So I need to find out my clients ISP's SMTP address and send via this? ...

Use of -noverify when launching java apps

I have seen many apps that take instrument classes and take -javaagent as a param when loading also put a '-noverify' to the commad line. The java doc says that noverify turns off the class verification. However why would anyone want to turn off verification even if they are instrumenting classes? ...

Replacement for JWebUnit / HttpUnit

We've used both JWebUnit and HttpUnit in the past to do functional tests of web applications. Both of them seem to have issues in handling javascript. We are not particularly interested in testing the javascript at this point, but JWebUnit and HttpUnit tests have broken since we added some small Ajax components (Dojo Date / Time pickers ...