java

Comparing the uses/applications of java vs. python

We're talking about uses; not static vs. dynamic typing, whitespace indentation, etc. It seems Python and Java are similar in that they are both cross-platform and used in the desktop programming and server programming arts. How is Python being used like Java? Is it another good way to write your cross-platform software? ...

Netbeans - Source classes don't have access to Test classes?

I have a NetBeans project set up with a bunch of source classes and about 10 jUnit test classes in a separate Test folder. From within the Test files I can import any other test file or source class. However, from within the normal source files, NetBeans acts as if the Test classes don't exist. Autocomplete on them won't work, and if I ...

Java Service Wrapper 3.2.3 on Mac OS X 64-bit

What's the best way to run an app using Java Service Wrapper 3.2.3 on Mac OS X 64-bit? sh.script.in works, but there is no macosx-universal-64 version of the wrapper native binary (on JSW's 3.2.3 downloads page anyway http://wrapper.tanukisoftware.org/downloads/3.2.3/). The result is the following error in the logs: INFO | jvm 1 ...

Java: Possible to have mutual, final class references?

Let's say I have two classes, named A and B, that are associated with each other such that it is most convenient if each class's object contains a reference to the other. In other words, class A has a variable "b" of class B. Class B has a variable "a" of class A. This way, the code in each class has easy access to the other class. I...

How to reorder a 60mb CSV file

I have a .csv file that is ordered in a certain way. I want to reorder it by another field. Your ideas would be much appreciated. I only have to do this once, not multiple times, so performance is not too much of an issue. What I am thinking. If I just create an object (java) to hold each of the fields and then create an ArrayList of ...

Java: Is SelectionKey.attach() broken?

In my implementation of Java NIO I have not been able to get SelectionKey.attach() to work. Basically, once clients connect (OP_ACCEPT interest ops) I add them to a map where their IP address maps to an object that maintains state for the client. Then, when an OP_READ occurs, I again retrieve the client's IP address, and this time get ...

Injecting EntityManager Vs. EntityManagerFactory

A long question, please bear with me. We are using Spring+JPA for a web application. My team is debating over injecting EntityManagerFactory in the GenericDAO(a DAO based on Generics something on the lines provided by APPFUSE, we do not use JpaDaosupport for some reason) over injecting an EntityManager. We are using "application managed...

Is Ruby as cross-platform as Java?

You can compile a Java application and run it in any machine where the Java virtual machine is located, independently of the underlying hardware. Since Ruby on Rails was built upon Ruby, I'm concerned if building software in Ruby in any environment is the same or not. There exists versions of Ruby for Windows, Linux and Mac at least. ...

How i run cygwin using java program?

I have installed cygwin on window to start crawling. It work well. Now i want to run cygwin and run a crawl program at starting of cygwin using java program code. If you provide some code for it ,it will be great help for me. ...

how to change Java cache folder automatically for WebStart programs

We have a java application deployed in a local LAN, which is cached in JRE cache folder. By default this cache space can be up to 1GB in size and in most cases here all computers have used that space in total. This will not be an issue if there is no need for doing daily backups of all user's home folders in LAN (and there are more tha...

How do I do a union in Java (or how can I get/set individual bits in a float)?

I have to admit in all my work with Java, I've never come across the need for a Java union (like the C union, not the SQL one) and I cannot find an answer here on SO. Admittedly, most of my work in Java has been at higher abstractions that bit-fiddling. I have a integer which I'm setting individual bits for and I want to print out the e...

What purpose does Class.forName() serve if you don't use the return value?

I've seen this line in a sample application for using a commercial JDBC driver: Class.forName("name.of.a.jcdb.driver") The return value is not used. What purpose does this line serve? ...

Detect repainted area of screen in java

I am creating an applet which will do something like screen sharing . For that I am using Robot class to capture screen area . I want to capture the dirty / repainted areas after first screen shot. I think RepaintManager manager can be used for that. but i dont know how can I use it. I am a novice so a java code will be helpfull. thanks ...

Deleting objects from an ArrayList in Java

Hi guys, I have a big doubt and I hope someone can help me out. I need to delete some objects from an arraylist if they meet a condition and I'm wondering which way could be more efficient. Here's the situation: I have a class that contains an arraylist containing some other objects. I have to iterate over this arraylist and delete all ...

How to make Java work with SQL Server?

I know this is a basic question, but I can't seem to find an answer and I apologize, if this question is way too stupid, but here we go: I am supposed to work with SQL Server (no problem so far) and with Java (love java, so no problem here either), but now: What am I supposed to do to make the combination work? I got: JRE 1.6 and the sq...

Hibernate @OneToMany without a separate join table

Consider the following database schema: create table UserGroup ( id int not null auto_increment, name varchar(200), primary key(id)); create table User ( id int not null auto_increment, name varchar(200), groupId int not null, primary key(id)); User.groupId = UserGroup.id, so a user can only be a member of one group, but a usergroup ...

JDBC Thin Connection

Hi All, I have installed NetBeans 6.5 with JDK1.6. And I want to connect between oracle with java in NetBeans 6.5. The question is: How do I configure JDBC to java 1.6? Thanks, Sopolin ...

Where can I download JBoss Developer Studio 2.0 GA?

I am trying to download JBoss Developer Studio 2.0 GA, but the best I can find on the SourceForge Downloads page is JBossIDE 2.0.0.Beta2. Is there a more recent version that I can download somewhere? (I don't mind building it from source, although it's not my preferred option.) Another question is about the file dates. In the download ...

How can I run servlet without user interacting

I want to excute a servlet to get server name,server port and ContextPath from request. But I don't want to invoke servlet by user interacting. I want excute this servlet by Java code. I'm not sure it's possible. Please give me recommendation. ...

Java not giving Error!

Here is my code - i am simply checking my MySQL database connection. But first i have compiled and run the program successfully. but then i have commented the line Class.forName . Still when i compile it runs successfully, without any error.Why? import java.sql.Connection; import java.sql.DriverManager; public class FirstJbdc { pu...