java

How to embed Java Web Start (with jnlp) application on google?

Hey All. I have created some simple app in Java, and 'deployed' it using Java Web Start (and jnlp) on my local machine. Now I would like to put it on the web, to have some feedback from various people. I was thinking about embedding my app in Google infrastructure (pages.google.com/sites.google.com/blogger.com - whatever). Question: H...

Is it possible to capture a system.out.print from java program in a csh variable?

I know this is lame way to do it. We need to capture a string that is dynamically generated in a Java program in the calling shell script and then use it later. Also this is to be done in an existing csh file. We considered the option of exporting it to an environment variable using putenv/setenv ... is that a better option? If so ho...

How to make a mapped field inherited from a superclass transient in JPA?

I have a legacy schema that cannot be changed. I am using a base class for the common features and it contains an embedded object. There is a field that is normally mapped in the embedded object that needs to be in the persistence id for only one (of many) subclasses. I have made a new id class that includes it but then I get the error t...

what are common AES encryption paddings in both c#.NET and java

Hi, I want to know which padding modes for AES encryption are common in both java and C#.NET Thanks Bapi ...

In GWT, how do you click and drag a large image to change the portion that is being viewed?

In my GWT application I am using Border Layout to display a large image within a Panel that is added to the Centre location. I would like to click and drag on the image to change the portion of the image that is displayed. This would be equivalent of using the scroll bars to move the portion of the image displayed on screen. This is sim...

Java String.replaceAll regex

What is the regex to strip the MY-CORP\ part of na inputed string like MY-CORP\My.Name with the java String.replaceAll method so I can get only the My.Name part? I tried public static String stripDomain(String userWithDomain) { return userWithDomain.replaceAll("^.*\\", ""); } but i got Unexpected internal error near index 4 ^.* ...

How do you persist a tomcat session?

i have a JSP web page that refreshes every 1 minute. on each refresh, the session object is checked for validity. When the tomcat web server restarts, the session goes away...and when the page refreshes, it says "invalid". anyone has a solution to my problem? ...

RMI Object transfert

Hi, i would like to transfer variable from an RMI client code source to a window code source for example a variable for know if the client is connected to the server from the client class to the window class. Thanks! ...

How to get the user roles in Servlet?

I'm using Jbos AS 5 and the DatabaseServerLoginModule for the authorization. I've my application policy defined as (for example only, not the actual code): <application-policy name = "jbossmq"> <authentication> <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> <module-opt...

Remote JMX connection

I'm trying to open a JMX connection to java application running on a remote machine. The application JVM is configured with the following options: com.sun.management.jmxremote com.sun.management.jmxremote.port=1088 com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.ssl=false I'm able to connect using localh...

Script to remove comments in Java.

Does anyone know how (or process) to remove comments from Java class file at build time? i would like to do this for specific packages in the project when the project is build using Ant. Any ANT scripts or some custom code most welcome. ...

J2EE integration with .NET for authentication

I have a Java Enterprise Edition web application, a standard WAR. I want to integrate this with an existing .NET infrastructure running IIS. To be specific, I need to be able to share user sessions between the two applications in some secure manner. Is there a "standard" way of doing this? Edit: I do not need full session sharing, sorr...

Java Reflection Equals Question

Hi Guys, Its been one of those days can someone help me out with this. I have 2 Stock Objects which I want to compare properties of at runtime. One instance is the cached instance, the other is a new stock instance which has just been delivered to my system, which may or may not equal the cached instance. See below where m is a method ...

Preserving keyboard layout in a JTextfield?

Simple example: 2 jtextfields, one for a spanish word another one for it's translation. Is there a way to preserve keyboard layout per jtextfield so that the user wouldn't have to switch back and forth? TIA. ...

Java/SWT: How to receive mouse events from an embedded window

I am embedding a windows application into my SWT application using 'reparenting'. That part works ok. I would now like to hook my SWT app into the message queue for the embedded app to receive mouse move events. I see that the OS class in SWT has a number of interesting methods for adding hooks but I have not been able to figure out how...

J2EE concurrency & locking

I have a MDB (Message driven bean) that receives messages with String which represent a word. Also I have a table in the database. The MDB should store in the table, the words and the number of times each word was received (counter). The problem is that to get better performance the MDB started in many instances and when the same new wo...

authentication method

I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the '...

Using JAXB to unmarshall elements with varying/dynamic names

I'm parsing an XML document that has nodes like the following: <objects> <dog> <data1>...</data1> <data2>...</data2> <data3>...</data3> </dog> <cat> <data1>...</data1> <data2>...</data2> <data3>...</data3> </cat> </objects> The elements data1, data2, data3 are always consistent. Only the parent tag vari...

JQuery frontend with Java and C# backends: design choices

I have to build a multibrowser web app which should be able to be installed in both Windows and Linux servers. I've thought of using a single client-side frontend built with JQuery, and two different backends, built with java and c# respectively. The client then would use ajax calls with json to communicate with MVC frameworks on the se...

SQL code inside Java classes

Our current project does not use Hibernate (for various reasons) and we are using Spring's SimpleJdbc support to perform all our DB operations. We have a utility class that abstracts all CRUD operations but complex operations are performed using custom SQL queries. Currently our queries are stored as String constants inside the servic...