java

Environment variables for java installation

How to set the environment variables for java in windows (the classpath ) ...

charAt() or substring? Which is faster?

I want to go through each character in a String and pass each character of the String as a String to another function. String s = "abcdefg"; for(int i = 0; i < s.length(); i++){ newFunction(s.substring(i, i+1));} or String s = "abcdefg"; for(int i = 0; i < s.length(); i++){ newFunction(Character.toString(s.charAt(i)));} Th...

match array against string in java

I'm reading a file using bufferedreader, so lets say i have line = br.readLine(); I want to check if this line contains one of many possible strings (which i have in an array). I would like to be able to write something like: while (!line.matches(stringArray) { // not sure how to write this conditional do something here; br.readL...

Drag and Drop compressed files from swing to native [update]

Hi, I am trying to move files from a compressed archive to the native system (basycally, windows' eplorer) through drag and drop operations. My only idea at this moment is to create a TransferHandler, which, when launched, will decompress the file in a temporary directory and set up that file as Transferable. Here is a snippet of cod...

Composite Application Framework Equivalent in Java

Just wondering what the opposing framework in Java would be for creating modular GUI applications, with things like event aggregation, etc. I know for Java there isn't a single definitive GUI framework, and so far I've seen the Eclipse RCP and Netbeans Platform, however these don't seem to do these kind of things. I'm a .Net developer ...

AU audio files for Java

Apparently Java only plays .au audio files and I want to play mp3 files. I want to convert them to au and do not want to use any third party library to play mp3 directly. Can you please let me know how I can prepare my mp3 files to be able to play them in Java. (specifically I'd like to convert mp3 files to au files with a freeware softw...

How to execute one test from large TestNG suite using testng.xml?

I have a TestNG suite with large amount of methods. I execute this suite using wrapper built on top of TestNG runner. All tests in the suite fail except one. What should I write in testng.xml to execute just that one failed test? Obvious solution is to assign unique group names to all of the methods and then specify name in testng.xml. ...

hibernate event detecter

I have a DB running on Oracle. I use Hibernate for data access. I want to be notified whenever an object is saved in the DB, so that I can do some custom work. I want an "event listener" if you could call it that. Is there a way to detect such task ? ...

load the data of an object by method after creating, or get a instantiated object with loaded data direct?

In a webapp, i have a data-model (let's call it Item). The data of this Item is filled by two methods. The first method is a XML parser (data import), the second reads the Data from a Database (while parsing the website). I see two possible ways to implement this class: first way: public class Item() { public void parseFrom...

How to set Accept-Language header on request from applet

Hi, I'm not familiar with Java but I need to make a request to a remote webservice from within my applet. The webservice (.Net 1.1) uses HttpContext.Current.Request.UserLanguages[0] to determine the language to use. But the value of this member is alway null. So is there a way to pass the Accept-Language header along with something li...

Flex Java BlazeDS Dashboard - use Spring/JDBC or Hibernate ?

Hi, I am developing a IT Monitoring Dashboard for the company I work at. The system will primarily perform monitoring of files, databases and servers. There will be a small part of the system which will allow the users to configure static data about the system eg: file locations, server names etc... So as the app. will be a dashboard a ...

ToolTip on second monitor is displayed at the edge of the monitor.

Hi, I have got a component. The ToolTip of the component is set by the setToolTipText() method. On the first monitor everything works fine. Now when I move the frame to the second monitor, the tooltips are displayed at the edge of the monitor (on the side to the firt monitor). This happens only with tooltips of this component. The probl...

so in java you can't have duplicate method names with different return and params?

Is it possible to have two methods with the same name but different parameters and return types in Java? Seems like it would be a good way to generalize a simple getter and setter.. You can do that with constructors why not with regular methods ? for example why not be able to do .. int getVal() { return int; } boolean getVal() { ...

Derived Constructor

In the following code: import java.io.*; public class MyClass1 { MyClass1() { System.out.println("base class"); } public void print() { System.out.println("base print"); } } class ChildClass extends MyClass1 { public ChildClass() { System.out.println("child class"); } ...

Roles/Priviledges in a Spring/Hibernate application

Hi, In a banking or similar application there are usually several roles defined and associated privileges required (for example a normal user could only do transactions but not post it while a supervisor can verify and post them, sort of maker/checker). We also need to add new roles and privileges in the system (not sure about the latte...

Java application properties file

I need to write a standalone Java application which will have a embedded HTTP server. I need to call a HTML page deployed locally with the application. The HTML page should display the properties listed in *.properties file deployed with the application. I should be able to change the properties value as well from the HTML page Is there ...

combo box in spring web mvc

Hello All... I am using spring web mvc for my app's UI part.. By using following code, i am getting List Box where i can select more then 1 value.. <form:select path="domainsList"> <form:options items="${domainsList}" itemValue="domain" itemLabel="domain"/> </form:select> But I need a drop down combo box... Can any one suggest how...

Java classloader tutorial

Hi all, Does anyone know of a good (and thorough) tutorial about Java class loading, how to extend that mechanism and how to actually work with the extension? Thanks! ...

class at runtime

Is there a way to create Java classes @ at runtime (classes methods n variables), with using Java reflection API ...

Is there a free GUI software to compile Java

Hi guys, I am a total total beginner in Java actually I am .net dev trying to fix something in java. I think I have fixed it however I need to compile the files. I have used the dos javac etc... but i never seem to get it right. I have 20 files to compile. Any suggestions on a gui? ...