java

How to open IE from java and perform operations like click() etc. through java?

I wan't to login to a website through Java and perform operations, like click, add text to a textfield, etc., through Java. ...

Simple Java Sound Applet won't work!!! ARG!!!

import java.applet.*; /** * SoundApplet.java - a simple applet that plays the "gong.au" sound file. */ public class AppletGame extends Applet { public void init() { super.init(); resize(0,0); AudioClip gong = getAudioClip(getDocumentBase(), "test0.au"); gong.play(); } } In Eclipse applet viewer it loads and d...

Incorporating Java Styles in code preview

I am creating a website where you have a text area to write java code and need to incorporate java style colors for classes, keywords etc.. just like a normal java editor would provide. Is there a plug-in kind of a solution for this. ...

Spring MVC; avoiding file extension in url?

I just started with Spring Web MVC. I'm trying to avoid file extenstions in the url. How can i do this? (I'm using Spring 2.5.x) Bean: <bean name="/hello.htm" class="springapp.web.HelloController"/> I want it to be: <bean name="/hello" class="springapp.web.HelloController"/> I cannot get it to work. Any ideas? Edit: Url-mapping ...

Eclipse function/plugin that finds corresponding junit class?

I've been searching high and low for an Eclipse feature that lets you right-click on a main source class and find the corresponding JUnit class(es), without me having to navigate through the test classes of my project. I am using Mylyn which helps reduce the clutter but it would be much easier if there was a feature that performs a find ...

Sandboxing JSR-223

I'm trying to sandbox JSR-223. Specifically, I don't want any script to have access to any of my classes. (I hear Rhino can do that with ClassShutter, but I want to do it generally. ie. for all script engines of JSR-223). I first tried to use the AccessController.doPrivileged solution, by passing no permissions at all. It works for most...

How should I choose where to store an object in C++?

Possible duplicate Proper stack and heap usage in C++? I'm beginning to learn C++ from a Java background, and one big difference is the fact that I'm no longer forced to: dynamically allocate memory for objects always use pointers to handle objects as is the case in Java. But I'm confused as to when I should be doing what -...

Java: Fonts and Pixels

Hello, I'm making a game and in the menu I want to display the text in the center of the screen. Is there a way in Java to get/calculate the width of a piece of text in a specified font with specified size and style. Martijn ...

Eclipse : Welcome page not getting displayed.

I am working on an application which is built on top of Eclipse. Though everything is working fine on windows, Sles 32 and 64 bit, but on SLED 64 bit the Welcome page is not getting Displayed. When you try to open the welcome page it throws an MalformedUrl exception with "Could not load Swt Style: content/shared.css" as error message. ...

What are all the possible values for SQLException.getSQLState?

SQLException.getSQLState retrieves the SQLState for the SQLException object. What are all the possible values that can be returned by this method? Can I use the value to identify specific errors that ocured in the database (i.e. can this value tell me if it was a PK violation, or a unique constraint, or column value to large etc)? Also,...

Associating a compiler with an editor

How does typical editors for java work? How do they associate javac and java to the editor so that once you say compile and run, it directs the file to the compiler, and extracts the output to the editor? ...

Is there a way to get/save the DOM with Selenium ?

What I'm looking for is a method that works like "captureScreenshot(String path)", but instead of producing an image is saves the DOM as it currently is. Note that the existing getBodyText() method is not enough. ...

java - passing array in oracle stored procedure

Hi, I have a Java app accessing an oracle stored procedure. The arguments to the stored procedure include an array type. I do it like the following... con = this._getConnection(); Connection narrowdConn = (Connection)WSJdbcUtil.getNativeConnection( (WSJdbcConnection)con ); callable = con.prepareCall("{call MY_PKG.MY_PROCEDURE(?, ?...

Is there a Unicode equivalent for `{\pGraph}` in Java / POSIX regular expressions?

According to the documentation of java.util.Pattern, the POSIX character class \p{Graph} ([:graph:] in POSIX notation) matches "a visible character: [\p{Alnum}\p{Punct}]". However, this is limited to ASCII characters only. Is there an equivalent class or expression for matching (visible) Unicode characters? ...

apache velocity: ship with compiled templates

Can I ship my application with compiled templates? I there such a thing at all compiled templates in velocity? Or are they obligatorily recompiled on every run? ...

Adding Joptionpane in shutdownHook

Hi Is there any way to show joptionpane in shutdownhook i.e I need to show a confirmdailog in my shutdownhook event ...

Communication between two nodes running Java apps using SSH tunnel

Hi, I'm running an application on a bunch of nodes in a class A network, but can only access them from my own system if I log into the only node in that network that also has a class B address. However, the client portion (with the GUI and everything) can run only on my system, so I need some way of communicating with the class A netwo...

How to stop Timer in Java.

How to stop timer function after some time in Java. ...

Un-committed database transactions and auto-increment columns

I encountered some curious behavior today and was wondering if it is expected or standard. We are using Hibernate against MySQL5. During the course of coding I forgot to close a transaction, I presume others can relate. When I finally closed the transaction, ran the code and checked the table, I noticed the following. All the times I...

Find by Object Attributes in JPA

Hi, i was wondering whether it is possible to find an object using an example object like you can in hibernate with: Cat cat = new Cat(); cat.Sex = 'F'; cat.Color = Color.Black; List results = session.CreateCriteria(typeof(Cat)).Add( Example.Create(cat)).List(); I know i can find by primary key, just not looking forward to writing a ...