Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We do not have any constants defined for these anywhere (and neither does java I think) or any other clever thing for dealing with them so they are in plain text littered throughout the code.
String tempFolderPath = System.getProperty("java.io.tmpdir");
How is everyone using system properties?
I saw an intriguing approach to a problem here by Mauricio Linhares.
Add the lock directly to this DataObject, you could define it like
this:
public class DataObject {
private Lock lock = new ReentrantLock();
public void lock() { this.lock.lock(); }
public void unlock() { this.lock.unlock(); }
public void doWithAction( DataObjectAction action ) {
this.lock();
try {
...
I am trying to build a java applet which downloads a file to the client machine. As a java application this code worked fine but when I tried as an applet it does nothing. I have signed the .jar file and am not getting any security error messages
The Code is:
import java.io.*;
import java.net.*;
import javax.swing.*;
public class printFile extends JApplet {
public void init(){
try{
j...
I have an applet the loadslibrary using a System call through a static method called loadLibrary.
System.loadLibrary("ReadRegistry");
This works fine as long as I call loadLibrary from within the applet. However, if from javascript I access another method, called handleLoad(), which calls the loadLibrary method, I get a java security error when I try to call the System.loadLibrary state...
I'm trying to create an excel file and save to local file system using java applet. After sign the application, i can successfully create the file by directly invoking the applet. However, when i try to call the method from javascript, it failed without any error message. I'm wondering if there is any policy control to prevent java method to be called from javascript?
<html>
<script ...
Suppose you have this class:
public class A
{
private int number;
public setNumber(int n){
number = n;
}
}
I'd like the method setNumber could be called only by objects of a specific class.
Does it make sense? I know it is not possible, is it? Which are the design alternatives?
Some well known design pattern?
Sorry for the silly question, but I'm a bit rusty in OO desi...
Hi I have created a Self Signed Applet , but not able to access local files system .What have i to do ?