java

Accessing Java static final ivar value through reflection

Can the value of a Java static final class variable be retrieved through reflection? ...

Can I launch a thread from a constructor?

Given the J5+ memory model (JSR-133) is the following code thread-safe and permissible? And if it's safe, is it acceptable in some situations? public final class BackgroundProcessor extends Object implements Runnable { public BackgroundProcessor(...) { super(); ... new Thread(this).start(); } public void run() { ...

How can one send a Ctrl-Break to a running Linux process?

I am debugging a memory leak in an application running on Sun's JDK 1.4.2_18. It appears that this version supports the command line param -XX:+HeapDumpOnCtrlBreak which supposedly causes the JVM to dump heap when it encounters a control-break. How does one send this to a background process on a Linux box? It appears that kill signals...

Java client-server communication

I have a Java application which is a long running process (lets call it a "server"). I have to write a desktop GUI (most likely in Swing), lets call it a "client", which can connect to this application and: display status updates from the application give specific "manually triggered" commands to the application Each interaction (co...

Socket connection to originating server of an unsigned Java applet

I have read everywhere that unsigned Java applets are not allowed to make network connections to any server but the one which originated the applet. This is OK for my application since my applet only needs to talk to the server. However, when I wrote a test applet to try opening a socket to communicate with a process on my development ma...

maven s3 wagon provider

How to deploy with wagon s3 provider? I've found several plugins, most of them are incomplete, some of them are not maintaned. There is also a sandbox plugin from official maven SVN repository but I'm figuring how to use it. Any hint? ...

Multi-threaded algorithm for solving sudoku?

I have a homework assignment to write a multi-threaded sudoku solver, which finds all solutions to a given puzzle. I have previously written a very fast single-threaded backtracking sudoku solver, so I don't need any help with the sudoku solving aspect. My problem is probably related to not really grokking concurrency, but I don't se...

Does setting Java objects to null do anything anymore?

I was browsing some old books and found a copy of "Practical Java" by Peter Hagger. In the performance section, there is a recommendation to set object references to null when no longer needed. In Java, does setting object references to null improve performance or garbage collection efficiency? If so, in what cases is this an issue? Co...

Java RSA decryption did not work for the data decrypted with its public key in IPhone

Hi I have created my rsa public key in java and send to my friend. My friend is using IPhone, he encrypted data with that key and send me the decrypted data then I decrypted the data with my private key. But I am getting errors for Bad Padding. I and my friend both did not use any padding explicitly for RSA. Thanks Bapi ...

Controlling JFrame from JMenuBar

I am trying to maximize JFrame from within JMenuBar, I can not pass a reference to the frame. Is it possible to get a reference to the frame that it is used in? i can get to the top level component but it does not have a way to maximize and minimize frame. public Container getApplicationFrame(ActionEvent event){ JMenuIte...

udp client not reachable from another application

I am trying to achieve a client server application in Java using UDP. The issue is when client connects to a server, server registers the client and another application tries to use the clientIP and clientPort to connect to the client; client is not able to get any data. I was able to recreate DatagramSocket to connect to Client using h...

How to understand Java Hotspot Errors

Guys when the JVM Crashes it writes an Error Log hs_err_pid.log. I want to find out what caused the JVM to crash ? How to understand these Logs, is it documented anywhere on how this Log is arranged. I tried to search on the Net but to no avail :-( Pointing out to relevant URL's will be appreciated. Thanks. ...

Reflection in C++

Hi, everyone. This is my very first question in SO. I've been working for years with Java. During those years, I've made extensive (or maybe just frequent) use of Reflection, and found it useful and enjoyable. But 8 months ago I changed my job, and now Java is just a memory, and I'm getting my hands on C++. So now I'm wondering if there...

phantom breakpoint driving me crazy!

I have no idea where it came from, it doesn't show up in my breakpoitns view, but every time I start my program, before it gets to my code it breaks at the beginning of FileInputStream.class It's just getting really annoying. I am using eclipse 3.4 and java 1.6. Thanks! Joshua ...

Monitor applications

how to monitor external applications(like notepad/word/exce/media players..) from java ...

Calling a java program from another

How do i call a Java command from a stand alone java program. I understand that Runtime.getRuntime().exec("cmd c/ javac <>.java"); would work. However, this would be platform specific. Any other APIs available that could make it work in j2sdk1.4 ? ...

Android device update for G1

Hi, I am using android G1 phone and now i have upgraded my sdk to 1.5 and i want to run my application on device but when i connect my phone to PC i am able to install my app only when i am selecting 1.1 sdk but not when selected 1.5 .So is there any updates required for the device so i can proceed with 1.5 sdk also .if possible ca...

Populate an enum with values from database

I have a table which maps String->Integer. Rather than create an enum statically, I want to populate the enum with values from a database. Is this possible ? So, rather than delcaring this statically: public enum Size { SMALL(0), MEDIUM(1), LARGE(2), SUPERSIZE(3) }; I want to create this enum dynamically since the numbers {0,1,2,3} ...

Java Deserialization of java.lang.Integer - Exception

Recieved the following exception when deserializing a HashMap<String, Integer>: java.io.InvalidClassException: java.lang.Integer; local class incompatible: stream classdesc serialVersionUID = 1360826667802527544, local class serialVersionUID = 1360826667806852920 Serialized and deserialized on the same machine, with the same JRE. JDK 1...

The user is not associated with a trusted SQL Server connection.

i wrote the code like this to connect sqlserver database.i load the driverclass,but iam not getting connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("class Loaded"); connection = DriverManager.getConnection("jdbc:sqlserver://10.171.160.114:2001","XXXXXX","XXXXXX"); ...