java

Java BrowserLauncher throwing InvocationTargetException

I'm using the BrowserLauncher2 library for opening the user's default web browser from my Swing app, but it's throwing a very confusing exception: public static void openURL(String url) { try{ BrowserLauncher launcher = new BrowserLauncher(); launcher.openURLinBrowser(url); }catch(Exception e){ ...

RMI/Exception handling in a custom JVM

I know that a custom JVM can behave a little differently, and I'm trying to see if my observed behavior is the same as the real JVM. Also, I'm looking for some way to consistently make this stuff work. The worst part I've been seeing is that exceptions are being completely eaten by the JVM. For instance: public myMethod(String test) ...

Server and Client using Sockets

Are there any examples of a server and a client that use sockets, but that have send and get methods? I'm doing this networked battleship program, almost finished, but can't get the server and clients to work. I have made a chat program that only sends strings, but this time I need to send objects. I'm already frustrated, so is there ...

Rhino: restrict Java packages that can be accessed from JavaScript

When embedding a JavaScript interpreter (Rhino) into a Java application (to be able to script that application), how would one go about restricting the Java packages that are available to scripts? For example, only "java.lang.*" should be accessible. ...

How to resolve WSDL2Java creating a static block larger than 64K?

We're currently working with a vendor-provided WSDL schema that is very large. The binding style is RPC. As far as I know, Axis 1.x is the only Java tool supporting RPC WSDL definitions. Please do correct me if I'm wrong about that. WSDL2Java generates a service-nameSkeleton.java file that has a static intialisation block 1.3Mb in size ...

HTTP URL Address Encoding in Java

My Java standalone application gets a URL (which points to a file) from the user and I need to hit it and download it. The problem I am facing is that I am not able to encode the HTTP URL address properly... Example: URL: http://search.barnesandnoble.com/booksearch/first book.pdf java.net.URLEncoder.encode(url.toString(), "ISO-8859-...

How to measure response-time of network using Java?

We have a client and a server. I want to measure the response-time of the network between them. When I send a request to server it should immediate respond to my request, it should be like a ping request so that there will be no processing time at the server. How can I do this in Java? ...

Should Java method arguments be used to return multiple values ?

Since arguments sent to a method in Java point to the original data structures in the caller method, did its designers intend for them to used for returning multiple values, as is the norm in other languages like C ? Or is this a hazardous misuse of Java's general property that variables are pointers ? ...

How to convert a 3D point into 2D perspective projection?

I am currently working with using Bezier curves and surfaces to draw the famous Utah teapot. Using Bezier patches of 16 control points, I have been able to draw the teapot and display it using a 'world to camera' function which gives the ability to rotate the resulting teapot, and am currently using an orthographic projection. The resul...

How can I open a file using java stored procedure

Hello all, I am using oracle database 10g. I have to write a java stroed procedure through which i can call a file at the server and store it locally at the users machine. Im using oracle Apex 3.1.1. ...

how can i fetch combo box value into my DAO using struts 2?

I have one simple User Registration form. It includes name, age, sex & city. But here city is coming form city master table & displaying user as a combo box. But when i am trying to store full user registration information through my UserDAO, how can i access that current selected city value ? My User Registration jsp form contains : <s...

struts2 <s:select...> tag

I have simple user registration form. In which i am puting city as a tag. Here drop down box value coming from city master table from mysql database. But when i storing whole user registration values, i m not be able to fetch currently selected city value. Can anyone help me...? My user registration form contains : <s:form action="Use...

Model View synchronisation (or avoiding synchronisation)

The overall structure of a given software system is model view controller. The view (graphical interface) is a representation of the model (domain object models). However, within the view (graphical interface) there are components (such as JTextComponent). These components too are arranged in Model View Controller. JTextComponent uses D...

ANTLR Grammar for Java Regular Expression syntax.

I'm currently working on a testing framework for regular expressions, and I need to be able to parse Java regular expressions into ASTs to be able to generate sample strings which match the given regex. I looked at the implementation of java.util.regex.Pattern but the code looks quite unwieldy (the emphasis was on speed over readability...

Does an open-ended interval implementation exist for Java?

I've got a classification of certain values in different intervals. Most have the form [20-30], but some are of the form [30-infinite). Is the an interval class you know of which can represent: an interval which is not closed on both sides (e.g. (0-5) or [0-5) ) an interval which closes (or starts) on infinite ...

Handling logins to a XMPP server via servlets

I would like to hear some comments about how to manage long lived XMPP connections on a servlet container i.e. Tomcat. Basically we have a client that submits login credentials to a servlet and we create a XMPPConnection for each session and store it in HttpSession. To simplistic, the client can perform 4 operations: login, send/receiv...

java swing program with multi lingual support

I want to create a TextArea in java where i can write data in chinese. How can I achieve this Thanks Bapi ...

How to get JSP scriptlet value in struts tag

Here is my code <% request.setAttribute("lcItem", "Hello"); %> if I do as following, m not gettin the value <s:property value="%{lcItem}"/> <s:property value="lcItem"/> If you have any suggestion plz specify Thanks in advance, Cheers ...

Character Encoding Trouble - Java

Hi all, I've written a little application that does some text manipulation and writes the output to a file (html, csv, docx, xml) and this all appears to work fine on Mac OS X. On windows however I seem to get character encoding problems and a lot of '"' seems to disappear and be replaced with some weird stuff. Usually the closing '"' o...

Detect user logged on a computer using Java

Hi! I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application. How can I do this? Thanks! ...