java

Related to executing Java programs through Python

I am using os.system to execute a java program through a python script. I need to pass a file name to the java program as an argument. I am not able to figure out how to pass the relative file location. What should be my reference for determining the relative location. I tried to use the location of the python script as the reference but...

jExcelApi - cell date format reusing doesn't work.

I created a wrapper to jExcelApi classes to easily export lists of objects to Excel. To minimize object creation cell formats are created as static fields and reused in consecutive calls to export. But I have problems with Date format - the first call works good, but in all consecutive exports date cells have numeric format instead of da...

java list of objects that all implement an interface

Suppose I have a class that implements an interface: public class A implements IB and I have a List<A> that I would like to reference to: List<? implements IB> list. So that I can code: for (IB item : list) etc. Can it be done somehow in Java? There is no <? implements ...> possibility. What am I missing? ...

Log4j for per class, how is precedence determined?

I'm trying to permit debug logging per a particular class using Log4j, and I've got the following: log4j.rootLogger=stdout, daily log4j.logger.com.mycompany.myapplication.mymodule=DEBUG log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.Conver...

Porting a Bash Script to Java

I'm attempting to emulate the functionality of the bash shell script below using a Process or ProcessBuilder object in Java. It's not 100% clear to me how I do the redirection for standard-in. How can I accomplish this? # # Redirect shell echo command from standard output to file # This will construct the input file # exec 1> $STDIN ...

Functionality of a web application to handle user's request to download files from SFTP Server

In our Java web application, customer wants to upload some large files to a SFTP server and download directly from there. The customers do not want to use any third party tool rather they want this functionality in the application itself. The file upload part has been taken care of by the JFileUpload applet component & libraries. Once t...

problem with iterate over java.util.Map using "JSF" OR JSTL TAGS

I'm using Richfaces JSF and I want to iterate over an Map<Object,Object>. I see many examples on Sun forums and other sites but in my case it doesn't work. Here is my XHTML code: <c:forEach items="#{order.customOptions}" var="option"> <h:outputText value="this text does not print" /> <h:outputText value="#{option.value.name}" />...

Java or Coldfusion?

Im not trying to debate which language is better, I'm just hitting a brick wall. I'm building an Adobe Air desktop app for several companies. I came to the conclusion that ColdFusion was better than PHP for this (I need the 'push' feature). But now I have hit a brick wall. In order to use ColdFusion, I must learn it first. When I look...

Java Database Connection Pool for multiple databases (Shards)

Hello, I was wondering what the best technique for implementing a DB connection pool for a web application which uses shards. From what I can tell most (all?) open-source implementations only support a single database behind. At least, I have not found one that supports shards. Also, even though I using shards not all of the database w...

Out of memory error at compile time Java 6.0

I know how to use -Xmx -Xms at runtime, is there a way to ask the compiler to allocate more ram. I have 2 gigs on my pc. I don't use an IDE just textpad. I am trying to create a BigInteger with 10,000,000 digits and do operations on it. I tried creating a StringBuffer and ensureCapacity(10000000) and it wont compile. Is there a clas...

Advanced Java-like enums in Ruby

First of all, this is not a duplicate of Enums in Ruby :) The accepted answer of that question suggests this as a good way to represent enums in Ruby: class Foo BAR = 1 BAZ = 2 BIZ = 4 end In Java it is possible to attach multiple values and methods to an enum value. I want to achive the same or something similar in Ruby. What...

Get filter init parameters in a servlet.

I have a filter that looks like this: <filter> <filter-name>TestFilter</filter-name> <filter-class>org.TestFilter</filter-class> <init-param> <param-name>timeout</param-name> <param-value>30</param-value> </init-param> </filter> Since we are talking ServletFilter and Servlets. Essential...

java.net.SocketException: Software caused connection abort: recv failed; Causes and cures?

Hi, all. I've got an application running on Apache Tomcat 5.5 on a Win2k3 VM. The application serves up XML to be consumed by some telephony appliances as part of our IVR infrastructure. The application, in turn, receives its information from a handful of SOAP services. This morning, the SOAP services were timing out intermittently, ...

Swing listen for child layout changes

I have a JPanel and when its layout changes, I need to re-layout the parent. This can easily be done with panel.getParent().validate(), but the problem is, I don't always know if its direct parent, or maybe some parent somewhere in the tree is really the one that needs to be validated. Is there a way for a parent component to listen to s...

Rendering arbitrary XHTML with JasperReports

We have embedded JasperReports into our application to generate reports, but I've been rather dissatisfied with the way that the JEditorPaneHtmlMarkupProcessor handles writing arbitrary XHTML. For example, I needed to output a bulleted list at one point, which it does, but because it converts it to actual bullet characters and newlines, ...

How to configure apache tomcat to use a different java home when it's installed as a windows service?

I want to redistribute tomcat as part of my application. I'll be distributing a bundled jre as well, and I need to have my app's installer a) install the tomcat service in windows and b) not have it use JAVA_HOME if it's already set on the machine. That is, I need tomcat to point to my bundled jre. I read here that you can pass a comman...

Is SecureRandom thread safe?

Is SecureRandom thread safe? That is, after initializing it, can access to the next random number be relied on to be thread safe? Examining the source code seems to show that it is, and this bug report seems to indicate that its lack of documentation as thread safe is a javadoc issue. Has anyone confirmed that it is in fact thread safe? ...

What is the point of setters and getters in java?

Please forgive the length, but here are two programs, both the exact same, but one with and one without setters, getters, and constructors. I've taken a basic C++ class before and don't remember any of these from it, and at the moment I'm not seeing the point of them, if anyone could explain them in lamen's terms I'd much appreciate it....

Using separate_jvm to start applet in individual JVMs not always working

I have an applet that takes a fair amount of memory so we want to start it with separate_jvm = true so that each instance gets its own JVM (rather than a shared one) so we don't run out of memory upon repeated invocations. This works on our development boxes, but fails on our clients' computers. Are there security reasons for this? Thi...

Integration of an EJB into a Framework?

Is there a way that you integrate an EJB into a Framework? I mean... this will be the framework's own EJB. This is a way of getting it started. WeeklyTimerBean Tbean = WeeklyTimerBean.getInstance(); Tbean.bahbah(etc); No JNDI connection and it will be on the server. I'm just wondering if there is a way to do this. ...