java

Embedding XULRunner application on Java

Hi, My goal is to get Limewire(JAVA) and Songbird(XULRunner) to run together. I was thinking the best way is to run the XUL application(songbird) inside a JAVA swing panel. Is there another way? Would it be better or possible to have the GUI entirely in XUL, and then access my JAVA objects somehow? How would I go about doing this? T...

How to set a SecurityManager for this thread and not for System ?

Hello, I have a program that is running a basic RMISecurityManager in all its threads. But I would like to do more control to several threads and set another SecurityManager specially for these threads. How can I do that ? ...if this is possible !? thank you by advance. Edit : I have found my solution. See here for more details. ...

What Java FTP client library should I use?

Since I received no positives answers to my last question. I will try to write a Java FTP upload applet myself. My question is: "Can you recommend a Java FTP client library for me to use?" I want it to be: stable able to handle passive and active modes able to provide upload progress information throw catchable exceptions if somethin...

What are major differences between C# and Java?

I just want to clarify one thing. This is not a question on which one is better, that part I leave to someone else to discuss. I don't care about it. I've been asked this question on my job interview and I thought it might be useful to learn a bit more. These are the ones I could come up with: Java is "platform independent". Well nowa...

Java/JCE: Decrypting "long" message encrypted with RSA

I've got a message contained in an byte[], encrypted with "RSA/ECB/PKCS1Padding". To decrypt it I create a Cipher c and initiate it with c = Cipher.getInstance("RSA/ECB/PKCS1Padding"); Untill now I have only decrypted small messages, using the doFinal() method, returning an byte[] with the decrypted bytes. c.init(Cipher.DECRYPT_MODE...

Fastest way to determine if an integer's square root is an integer

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer). I've done it the easy way, by using the built-in Math.sqrt() function, but I'm wondering if there is a way to do it faster by restricting yourself to integer-only domain. Maintaining a lookup table is impratical (...

Connecting to SQLServer using JDBC-ODBC Bridge

I'm writing an applicationt hat was prototyped on MySQL and is now connecting to an Oracle database. All I had to do to connect to the oracle database (having built up the table structure) was change the connection string. What is the format to connect to a SQL Server DB on another machine? I've read some tutorials which tell you to u...

SecureRandom: init once or every time it is needed?

Our team is using a SecureRandom to generate a list of key pairs (the SecureRandom is passed to a KeyPairGenerator). We cannot agree on which of the following two options to use: Create a new instance every time we need to generate a key pair Initialize a static instance and use it for all key pairs Which approach is generally bette...

Pattern for connecting to different databases using JDBC

I'm writing an application which has to be configurable to connect to Oracle, SQL Server and MySQL depending on client whim. Up till now I'd been planning on using the JDBC-ODBC bridge and just connecting to the databases using different connection strings. I'm told this is not very efficient. Is there a pattern or best practice for ...

How to register a JavaScript callback in a Java Applet?

I'm developing an invisible Java Applet, that will be controlled entirely from JavaScript. I can call the applet's Java methods easily, and I can call JavaScript methods from within the applet by using netscape.javascript.JSObject.getWindow(this).call(). But in order to register a JavaScript callback in the applet, I guess I would need...

Adding rows to a JTable

We have a simple project where we read data from a socket and we want to populate a table with the coming data, but we can't find a way to add rows to a yet created JTable object, we can only find how to add rows at creation time of the table. Is it possible to add rows dynamically to a JTable, or there is a better alternative object to...

Using the eclipse remote debugger and getting com.sun.jdi.InternalException: Got error code in reply:35 occurred while retrieving value. for all expressions

I am getting this error for all expressions and cant find anything on it. My guess is that the debugger isn't correctly connecting to the remote version, but I am not sure. ...

Spawn a process in Java that survives a JVM shutdown

I need to spawn a process in Java (under Linux exclusively) that will continue to run after the JVM has exited. How can I do this? Basically the Java app should spawn an updater which stops the Java app, updates files and then starts it again. I'm interested in a hack & slash method to just get it working as well as a better design p...

Java SAX Parser raises UnknownHostException

The XML file I want to parse starts with : <!DOCTYPE plist PUBLIC "-//...//DTD PLIST 1.0//EN" "http://www.....dtd"&gt; So when I start the SAX praser, it tries to access this DTD online, and I get a java.net.UnknownHostException. I cannot modify the XML file before feeding it to the SAX parser I have to run even with no internet co...

Configure Hibernate to escape underscores in LIKE clause using SQL Server dialect

I have a SQL SELECT query which has a LIKE clause containing an underscore, which should specifically look for an underscore, not treat it as a wildcard: SELECT * FROM my_table WHERE name LIKE '_H9%'; I understand that I can change the actual clause to '[_]H9%' for this to work as I expect, but the problem is that this clause is bein...

calling a .jar from Coldfusion

I have a .jar file that i've placed in my D:\Coldfusion8\wwwroot\web-inf\lib\ directory. The file is abcdef.jar This is my first time doing this, not sure what the path should be in my createObject(). <cfset abcObj = createObject("java","com.abcdef") /> <cfset result = acbObj.doStuff("123456") /> But when I run it, I get Object In...

How to create project in WebLogic Workshop with support for JPA entity beans?

How to create a project in WebLogic Workshop (version 10.3) with support for JPA entity beans? I am trying create a separate EJB and EJBClient projects in Workshop and EJB3 session beans work just fine, but I am having problems with JPA entity beans. It seems that when creating a new project you can add support for JPA and BEA Kodo if...

Java batch monitoring

We have 50+ Java batch processes that run at different times of the day. They run on a Solaris box, and are started via cron. Currently, the only way we only know if they succeed or fail is by an email generated at the end of each batch process. We have a support team that monitors these emails. Recently, we've had issues with emails...

How can I abort a running JDBC transaction?

Is there a way to prematurely abort a transaction? Say, I have sent a command to the database which runs five minutes and after four, I want to abort it. Does JDBC define a way to send a "stop whatever you are doing on this connection" signal to the DB? ...

EMMA won't cover one of my projects

Hi, I have an issue with EMMA where it is correctly covering all my various Java projects except one. I am puzzled as to why this occurs as the ANT script appears to be correct. The following expected output is given: [echo] c:\cc_local_home\emmadata\ProjectName [instr] processing instrumentation path ... [instr] instrumentation path ...