java

Java custom logger: logging standards or/and best practices

I am developing a framework and I won't the jar to be light weight and independent as much as it can be. So I wrote my logging class: import java.util.Date; import java.util.Properties; public class Logger { private static final Logger me = new Logger(); private static boolean info = false; private static boolean debug = false; ...

web service client reference, in a servlet

I have a servlet, and that servlet uses a .net web service to perform some function. To do this, I created the webservice client in Netbeans using the "jax-rpc" style client. Let's say that my service name is "Tester". Then two of the generated classes are called "Tester", and "TesterSoap". To get a reference to the web service, I need...

JSF - session scoped bean shared by browsers on different machines

We have a search form where the filter is bound to a property on a managed bean (session scope). It's not component binding, its property binding like <h:inputText value="#{searchBean.filter}"/>. Submitted data from different machines (different sessions, then) is getting mixed. You search "john", and get "mary" just because the guy bes...

Runtime.getRuntime().exec() with a non-ASCII string in Windows?

Trying the following method to open an Arabic URL: String cmd = "cmd.exe /C start \"Open file\" \"http://ar.wikipedia.org/wiki/موسوعة\""; Runtime.getRuntime().exec( cmd ); Unfortunately, the URL being opened is http://ar.wikipedia.org/wiki/?????? Any thoughts on why this is or how I could prevent this? Before you ask why I don...

To Compress a big file in a ZIP with Java

I have the need to compress a one Big file (~450 Mbyte) through the Java class ZipOutputStream. This big dimension causes a problem of "OutOfMemory" error of my JVM Heap Space. This happens because the "zos.write(...)" method stores ALL the file content to compress in an internal byte array before compressing it. origin = new Buff...

Why does Eclipse 3.5.1 narrow to the declaration when I go to the declaration of a field?

I just installed 64-bit Eclipse 3.5.1 on SnowLeopard. I am experiencing a rather strange problem, and I'm posting a question here to see if anyone can explain or confirm it before I go get tangled up with the Eclipse bugzilla. I open up a Java class with some errors in it. I double-click on a reference to a field. I click right and sele...

Mouse events on an SWT Scrollbar

Using standalone SWT Scrollbars is something of a hack (using this workaround), but it can be done. Here's a snippet: ScrolledComposite scrolledComposite = new ScrolledComposite( parent, SWT.V_SCROLL); ScrollBar scrollbar = scrolledComposite.getVerticalBar(); Shell tip = new Shell(UserInterface.getShell(), SWT.ON_TOP | SWT.NO_FO...

Java: Why isn't autoboxing happening here?

This gives me an error: int[] l = new int[] {0, 2, 192, -1, 3, 9, 2, 2}; int[] l2 = new int[] {9001, 7, 21, 4, -3, 11, 10, 10}; int[] l3 = new int[] {5, 5, 5, 64, 21, 12, 13, 200}; Set<List<Integer>> lists = new HashSet<List<Integer>>(); lists.add(Arrays.asList(l)); Eclipse: The method add(List<Integer>) in the type Set<List<Inte...

why it returns null password???

In my Generator class ,I make a new password and also I have a SystemManagements class which imports Generator class (it is in the other package) and I have some information like name and family of user and I make an object which its type is SystemManagement but when i call getPassword() on my object it will return null!!!?????? public ...

Java Generics: compareTo and "capture#1-of ?"

The following gives me an error message: public static List<Comparable<?>> merge(Set<List<Comparable<?>>> lists) { List<Comparable<?>> result = new LinkedList<Comparable<?>>(); HashBiMap<List<Comparable<?>>, Integer> location = HashBiMap.create(); int totalSize; for (List<Comparable<?>> l : lists) { location.put(l, 0); totalSiz...

Is it possible to use Java to create dll?

Want to create animation dll for Window XP Is it ok to create Java2d animation and export as dll?? ...

JUnit java.lang.OutOfMemoryError when running all tests in a package

When loading all unit tests in a package, the make task throws a java.lang.OutOfMemoryError: Java heap space error. If I run all the tests in each subpackage, though, all tests load and complete just fine. It is only when I try to run all tests in the parent package that the OOM error occurs. I don't think this problem should be solved...

Debugging customer firewall issues

How do you debug a firewall issue with your application at a customer site? Currently we have an issue where Apache and Tomcat (part of the application) throw errors that sound like the firewall is blocking our attempt to accept or bind to ports on the machine. The problem for us is we can't see what the firewall is doing, because it i...

Eclipse as an IDE - What do you find missing as a beginner in Java?

I am working on a solution that aims at solving problems that newbie programmers experience when they are "modifying code" while bug fixing / doing change requests, on code in production. Eclipse, as we all know is a great IDE. Features such as Code Completion, Open Declaration, Type Hierarchy, Package Explorer, Navigator, Finding Refere...

PostgreSQL and JMS (Or other Pub-Sub/Callback Mechanism)

I want to have my PostgreSQL server send out notifications when a piece of data changes, preferably over JMS, but also considering any other Pub-Sub mechanism or Callback. Any ideas if this is possible? Are there any available Java Add-on Packages that replicate this sort of functionality? ...

Hibernate Cross Reference many-to-many Parent/Child Mapping Of Same Class

I'm having a major problem getting a parent/child relationship working for a hierarchy of a single class. Basically I have to represent a server tree like thus: Server A Server B Server C Server D Server E Server C Server D Server F Server G Note that the children of Servers B & E are th...

Manually trigger the CellEditor in a RCP TableViewer

Hey folks, I'd like to comfort the user by automatically jump to the next cell in a tableviewer, when a previous editing is completed. The user needs to modify start- endtimes in a list of entries. I was wondering how am I supposed to manually (programatically) trigger the CellEditor for a specific cell. I haven't seen that before in Ec...

2d ArrayList in Java adding data

I need little help on a homework assignment. I have to create a 10 by 10 ArrayList, not an array that would make too much sense. This is what I have and I just need a hint on how to do a for loop to add the date to the 2d ArrayList. By the way this is for putting data that are grades; going from 100 to 82. (Yes I know it is homework but ...

Print Jasper Report without pages

I'm creating HTML (popup window), EXCEL and PDF report and would like to show my reports on one page. This report is not going to be used for printing, so there is no need separate my report into pages. Plus later users would like to use Buildin Excel sorting. Is there an option to ignore pages? ...

java: Difference between thread's context class loader and normal classloader

What is the difference between a thread's context class loader and a normal classloader. That is, if Thread.currentThread().getContextClassLoader() and getClass().getClassLoader() return different class loader objects, which one will be used? ...