java

.NET equivalent of java.util.Arrays.toString(...) methods in Java

In Java, the java.util.Arrays class have several static toString(...) methods that take an array and return its string representation (i.e. the string representation of the contents of the array separated by commas and the whole representation enclosed in square brackets -- e.g. "[1, 2, 3]"). Is there an equivalent method/functionality ...

How can I compile Java code in Windows without installing the whole JDK?

Let’s say the runtime environment (version 1.6.0_01-b06) is already in place, but since I lack administrative privileges in this particular PC, the JDK can’t be installed. So, is there any portable JDK or standalone Java compiler for Windows that doesn’t require installation? ...

How to pass a system property using Wrapper.exe

How do I pass a property to a Java process, started as a Windows service using Wrapper.exe? The target code calls: System.getProperty("ADMIN_USERNAME"); ...

What Java IDEs work well with existing GUIs and may help with conversions?

I have an application of some 85 "frames" which was originally written with JBuilder 5 - an early IDE. The app is pure Java and I think it's all mostly Swing and AWT. So, the core question is: What IDEs can help me both maintain my existing application, possibly convert it from standalone to JSP, and hopefully also help with new developm...

How can I use OpenOffice in server mode as a multithreaded service?

What is the experience of working with OpenOffice in server mode? I know OpenOffice is not multithreaded and now I need to use its services in our server. What can I do to overcome this problem? I'm using Java. ...

How to print data which is inserted into linked list using linkedlist library of java

class Collection { int sNo; String sessionID; int noOfDependency; int noOfRejection; int totalValue; Collection(int sNo, String sessionID, int noOfDependency, int noOfRejection, int totalValue) { this.sNo = sNo; this.sessionID = sessionID; this.noOfDependency = noOfDependency; ...

Eclipse toolchain behavior

I've added a toolchain to a plugin for Eclipse 3.4.1/CDT 5.0.1. Basically, the way it's meant to work is, when I do a full build, we get my_compiler -c foo.c gcc -o foo foo.o And, when I do a build from Project|Build All, that's what I get. If I invoked the build programatically, I get my_compiler -c foo.c gcc -o foo.o That's rig...

whats wrong with this Jar file?

I'm trying to turn my JoGL project into a jar. Can someone tell me what I'm doing wrong? http://www.megaupload.com/?d=MA3LF50J EDIT from schnaader: Stacktrace from my PC: EDIT FROM WILLIAM: It runs on my PC just fine as a normal project inside JCreator, so I know it's not the code. I have JoGL in the /lib/ext/ folder of my jre too. E...

What is the fastest way to read a large number of small files into memory ?

I need to read ~50 files on every server start and place each text file's representation into memory. Each text file will have its own string (which is the best type to use for the string holder?). What is the fastest way to read the files into memory, and what is the best data structure/type to hold the text in so that I can manipulate...

How to convert Milliseconds to "X mins, x seconds" in Java?

I want to record the time using System.currentTimeMillis() when a user begins something in my program. When he finishes, I will subtract the current System.currentTimeMillis() from the start variable, and I want to show them the time elapsed using a human readable format such as "XX hours, XX mins, XX seconds" or even "XX mins, XX second...

Is Java Reflection on Inherited Methods Different in Windows and Linux?

While setting up Hudson for continous integration testing (on a JeOS server), I've come across some strange behaviour I'm hoping the fine people at SO can explain to me. Our unit tests depend heavily on the use of domain objects, with lots of properties that must be set (due to null constraints in the database). In order to keep our tes...

.Net vs Java for mobile development. What's your take?

Hi there, I am developing mobile apps for some time in .NET and I was always wondering if the grass is greener on the other side (Java). Thus, I would like to ask your opinion about which one you prefer for your mobile apps and why is that so. ...

Java - getClassLoader().getResource() driving me bonkers

I have this test app: import java.applet.*; import java.awt.*; import java.net.URL; public class Test extends Applet { public void init() { URL some=Test.class.getClass().getClassLoader().getResource("/assets/pacman.png"); System.out.println(some.toString()); System.out.println(some.getFile()); System.out.pr...

Editing a JTable with Vectors

Hi, I'm doing a mini project using JTable. I used the Vector type for the row values. For example, public Vector textData = new Vector();. The problem is when I edit the cells in the JTable, it is editable but not keeping the changed value. That is, when I enter data in 1 cell and move on to next cell, the previous data is not updated....

How to temporarily disable a message listener

What would be a nice and good way to temporarily disable a message listener? The problem I want to solve is: A JMS message is received by a message listener I get an error when trying to process the message. I wait for my system to get ready again to be able to process the message. Until my system is ready, I don't want any more messa...

Java: A synchronized method in the superclass acquires the same lock as one in the subclass, right?

class A { public synchronized void myOneMethod() { // ... } } class B extends A { public synchronized void myOtherMethod() { // ... } } // ... B myObject; // ... myObject.myOneMethod(); // acquires lock myObject.myOtherMethod(); // same lock? How I understand the synchronization model, I'd say that ...

(Java) Specify number of bits (length) when converting binary number to string?

I'm trying to store a number as a binary string in an array but I need to specify how many bits to store it as. For example, if I need to store 0 with two bits I need a string "00". Or 1010 with 6 bits so "001010". Can anyone help? EDIT: Thanks guys, as I'm rubbish at maths/programming in general I've gone with the simplest solution w...

What to replace this java code with?

The following code is used for playing a sound file in my java applet: public synchronized void play() { try { //Here filename is a URL retreived through //getClassLoader().getResource() InputStream in = new FileInputStream(filename.getFile()); AudioStream as = new AudioStream(in); ...

drawImage() for .png files doesn't work in Java applet?

I made this pacman game using an applet. When the applet finishes loading, it is meant to display a 'start menu' graphic i made which says 'Double click to start the game', etc. The graphic would take up the whole 400x400 applet. Here's the code: public void paint(Graphics g) { if (! isRunning) { switch (result) { case 0: s...

How to extends the the class java.security.SecureClassLoader?

I want write my own ClassLoader. It should be faster and more dynamic as the default ClassLoader for Applets. But I does not know how I should implements the method: PermissionCollection getPermissions( CodeSource codesource ) The super implementation grant no rights also if there is a valid certificate in the CodeSource. Must I ver...