Take the following example:
public void init() {
final Environment env = new Environment();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
env.close();
}
});
}
Firstly, where is env stored? Is it:
copied by the compiler into a hidden member variable of the inner clas...
Hello ,
I want to know which is the best tool which can be used to make GUI . Currently I'm working on VC++ 6.0 and I can't give a good look(Vista Look) in that.
So can anyone help me which one will be more suitable for GUI .. Java or any other tool(.net WPF) and if you can give the reason then it is very helpful.
Thanks
...
If I create a custom annotation like this:
public @interface TODO
{
String msg();
String start_date();
}
then a method:
@TODO
(
msg="will be developed!",
start_date="05/01/2010"
)
public static void Calculator()
{
}
after I call it:
Calculator();
If I wanted that the compiler warn me about it how could I do tha...
Hi,
is there a way to add a specific directory to the Windows systemvariable %PATH%?
This doesn't seem to work:
String[] cmd = { "cmd", "/c", "set", "PATH=\"%PATH%;c:\\test\"" };
Runtime.getRuntime().exec( cmd );
c:\test\ doesn't appear in System.getenv("PATH"); or in the output of
String[] cmd = { "cmd", "/c", "echo", "%PATH%" };
...
How can I do the username and password authentication(the username and the password is stored in the database then contact with the database to validate if the username and the password is valid or not. If the username and the password is valid then show the next page otherwise show the same login page with error message)
...
hi all,
we are currently establishing fitnesse as the testing tool user acceptance testing. so far everything is good. we are using the java version "20091121". we are having troubles with folders that are deeper than 4.
we have setup the following folder structure
SetUp
TestSuite
content.txt + properties.xml (just "!cont...
I have some native thread that needs to call into Java. For that, I need to attach the thread to the VM using AttachCurrentThread. Since this callback will happen quite often, the thread should probably stay attached. Calling AttachCurrentThread multiple times is fine ("Trying to attach a thread that is already attached is a no-op.")
...
I can't seem to run a simple Hello World program using eclim. I followed the install guide at http://eclim.org/guides/install.html#guides-install and the tutorial at http://eclim.org/gettingstarted.html#gettingstarted, but when I try to run the program (using :Java) I get
java.lang.RuntimeException: Required setting 'org.eclim.java.run...
I need to send simple html-message with JavaMail. And when I tried to find some nice examples with explanations in the Internet, each next example made me more angry and angry.
All those silly examples contain copied and pasted Java code which differs only in comments and a nice disclaimer that first you should config your smtp and pop...
This is my code to construct a possible tour of citys in a Locale l (it's not optimal it's just to give my AI search a head start).
I'm getting a ConcurrentModificationException, which to my knowledge happens when more than one piece of code accesses an variable / collection and attempts to modify it. Causing this code to get unhappy:
...
I data in the below format (List of HashMap's)
{TeamName=India, Name=Sachin, Score=170}
{TeamName=India, Name=Sehwag, Score=120}
{TeamName=Sri-Lanka, Name=Sangakara, Score=20}
{TeamName=Sri-Lanka, Name=Murali, Score=20}
{TeamName=Sri-Lanka, Name=Jayasurya, Score=70}
I have to generate the following XML structure:
<node id="1" label="...
I've a problem with setAccelerator(). Right now, I have the code that works for Ctrl+X for DELETE operation. I want to set the accelerator to Shift+Delete as well for same JMenuItem.
My code as follows:
JMenuItem item = new JMenuItem(menuText);
item.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_X, KeyEvent.CTRL_MASK));
item.se...
After some research:
How to create a Zip File
and some google research i came up with this java function:
static void copyFile(File zipFile, File newFile) throws IOException {
ZipFile zipSrc = new ZipFile(zipFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(newFile));
Enumeration srcEntries = zipSrc.e...
Hello.I'd like to make "double-click" cli application but still don't get how.
I know I should propably somehow edit manifest but that is all. I googled ofc. but no success.
Thanks for any tips.
Here is the output from build, run, and manifest:
compile:
Created dir: /home/nick/NetBeansProjects/SemestralWork/dist
Building jar: /home/nick...
Hello!
I'm about to develop widget that will consume a web service built on top of existing functionality and it's requires that that web service should be aware of where the request is coming from.For example a consumer in the registration can provide information about it's blog or it's website that will be using the widget.
Now i need ...
I am trying to get an overview of the thread safety theory behind the collections in C#.
Why are there no concurrent collections as there are in Java? (java docs). Some collections appear thread safe but it is not clear to me what the position is for example with regard to:
compound operations,
safety of using iterators,
write opera...
private static void changeString(String s) {
s = new String("new string");
}
public static void main(String[] args) {
String s = new String("old string");
changeString(s);
System.out.println(s); // expect "new string"
}
How could I make the output of "new string" happen with s as the only argument to method changeStrin...
Hi,
I would like to add java's default questionIcon to a corner button in a Scrollpane, however the image doesn't fit correctly (since the button is very small). What should i do to make the icon fit correctly?
Here is the code, It works, so you can try it out and see for yourselfs the problem :)
import javax.swing.*;
public class Co...
Hi,
I want to sort my objects in descending order using comparator.
class Person {
private int age;
}
Here i want to sort a array of Person objects. How to do?
Please give me a solution,
Thanks.
...
Hi Geeks,
I am making a GUI application for operating a remote device through serial port. For this I am using two threads - "reading from" and "writing to" serial port. My main application frame contains one menubar with menuItems and submenu items and one scrollable text area. Now I am putting all the output from serial port to text a...