java

Firefox kills Java applets when out of view

Hiding a Java applet using display: none causes firefox to kill the applet until it is visible again. It also seems to kill the applet if you position the applet out of view ie. position: absolute; left: -9999; Using visibility: hidden; will hide the applet without killing it, but then the applet still takes up space in the layout wh...

ant build and deploy question

I have a question about something I encountered today at work. I have two projects that are built with ant build script. Lets call them projectA and projectB. ProjectA builds projectA.jar, and projectB builds projectB.war, and projectB.ear. ProjectB.war includes projectA.jar in the web-inf lib directory. In projectB there is ...

Netbeans project in Eclipse

Hello, I am Java beginner. I have developed only two Java desktop applications and I use Eclipse as IDE. Right now I wanted to work on this project https://nbjfuguesupport.dev.java.net/ All code is in Netbeans. I suceeded to import all libraries that are used in source files in eclipse, and I have no errors showing in code in Eclipse. T...

Java setting values from a Map to a Set

Hello! I am trying to make a method that takes the first Map whose values are sets and a second empty Map whose values are Lists and fills the second Map with the same key/value Mappings as the first. The 2nd map will have every key in the 1st Map, but associated with it is a List of all the same elements that are in the Set it maps to. ...

Java swap two keys in a Map

Welcome. I have a generic void method swap that takes a Map and 2 keys. The method will swap the values associated with the keys in the Map. I already checked that both keys are contained in the Map somewhere else, but in this method, I can't use looping. My method answer: public static<K, W> swap(Map<K,V m, K key1, K key2>){ m.put(ke...

Palindrome tester with Java, ignoring spaces and punctuation

I have the program made up until the point where it has to ignore and punctuations and spaces in the thread and I was wondering if anyone could help me with the coding for that? What I've been trying out doesn't seem to be working. Here is what I have so far: import java.util.Scanner; public class PalindromeTester { public static void ...

Can you extract the value of strings from an IBM PHD java heap dump?

I have a PHD format heap dump from an IBM jvm and I wish to examine the values of some strings. With the Sun JVM's binary hprof dumps this is possible, but I haven't been able to recover this information from an IBM dump. I've tried: Eclipse Memory Analyzer (0.8.0.200906170940) with IBM's DTFJ Portal Heap Dump Reader (1.3.0.2009032416...

How to set classpath when I use javax.tools.JavaCompiler compile the source?

I use the class javax.tools.JavaCompiler (jdk6) to compile a source file, but the source file depends on some jar file. How to set the classpath of the javax.tools.JavaCompiler? ...

Ways to do a 2 dimensional array in java?

I want to store 2 dimensional values i.e. B-1, C-2, D-3, etc. Any suggestions on the classes or interfaces that can be used? ...

Netbeans generated code

I have a netbeans project that I imported into eclipse. When I use my code formatting style in eclipse, it breaks the auto generated code in Netbeans. The code is similar to the following. private void customActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_customActionPerformed // aaa }// GEN-LAST:event_customAc...

Quicksort not working

This is all my code for my quicksort method, it works on a set of 21 numbers, but not on my real data set, which is about 100000. I have no idea what is wrong, I've been fiddling for two hours and it is due soon! Any help would be very welcome public static void hybridQuicksort( int[] a, int start, int end ) { final int MIN = 13; if (...

How to open an email client and automatically attach file in java

Hi everyone, I need to create a java code that will open an email client (Outlook, outlook express , etc) and automatically attach a file in it. I tried using mailto but it only opens the mail client and do not attach the file. Help please. thanks a lot. ...

Java unicode question

Hello all, This may be a silly question but... Say I have a String like 4e59 which represents a special unicode character. How can I add the \u to the beginning of that character so that it displays correctly? I've tried the simplest solution of: String str = "4e59"; System.out.println("\\u"+str); And several other variants, what am I...

SpringJUnit4ClassRunner initialize beans for each test?

The following test illustrates that this test bean is initialized twice by Spring. I'm hoping someone can tell me why this is so, since it should only be once. Here's the test: import org.apache.log4j.Logger; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.InitializingBean; import org.s...

JBoss Authentication Question(s)

I have a three-part question related to JBoss 5 Authentication (in the Web/EJB containers): Is there a way to propogate an identity other than the username that was specified during login? For example, using the DatabaseServerLoginModule, I want to authenticate the user with a username/password but return the user's id, and not usernam...

Format ParseException with JavaCC

I was wondering how could it be possible to format in a human-readable format a ParseException thrown by JavaCC: in fact it includes fields such asbeginLine, beginColumn, endColumn, endLine in the token reference of the exception, but not the reference to the source parsed. Thanks! :) ...

While Copying plist to somewhere else filetype getting changed

I am interested in copying the plist from my application to somewhere in the folder. I am trying but that file's type getting changed Unix Executable file to Document Is there a way to programmatically copy the file without changing file type ? Can any body help me ? Thanks in Advance ...

Adding content to ms word, Include macro

Hi All, I have a JSP file that is going to flush all data from database into a ms-word document by setting the content-type keyword. Now the problem is I need to add header and footer to the same document for which after many searches couldn't find a direct way from JSP without using APIs like POI. So I went ahead and created a macro for...

Supporting covariant type conversions in Java

The Java type system supports only invariant types. So a List<String> is not an List<Object>. A List<String> is not a List<Object> as it is not valid to insert an Integer into a List<String>. However, there are types for which such a covariant type conversion is valid. Given the classes A, B and Producer: class A{} class B{} interface ...

Paint component doesn't print polygon according to intended coordinate

I have problem drawing the triangle polygons based on the coordinates which are stored in linked list. When I checked the linked list elements using System.out.println in paint component method Public void paintComponent (Graphics g) { ... for (Polygon p : triangles) { g2.drawPolygon(triangle); ... // print the elements...