Abhinav Anand

Ranch Hand
+ Follow
since May 02, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Abhinav Anand

Congratulations Raj.

What books you referred for UML. Also please provide the breakup of your exams.
Try this book. I am referring to it for my preparation.

Sun Certified Enterprise Architect for J2EE� Technology Study Guide
Mark Cade, Simon Roberts
Publisher: Prentice Hall PTR
First Edition March 11, 2002 ISBN: 0-13-044916-4, 220 pages

(Search for this book on amazon)
Hi all,

As far as i know about java for all these years. The following rule applies for arrays:

If the elements in an array are not purposely initialized when the array is created, the array elements will be automatically initialized with default values. The default values are:

* All reference types: null
* Primitive numeric types: 0
* Primitive boolean type: false
* Primitive char type: the Unicode character with 16 zero-valued bits ('\u0000' (the NUL character)

I have to prove to my client (he is in automation field) that a primitive array is by default initialized with 0. Please tell me where in the java specification is this behavior guaranteed.

Thanks in advance,
Regards,
Abhinav
19 years ago
Hi,

Either re-install the JDK 1.5 again to resolve the problem or try to setting the path to the actual jdk "installation folder\bin". It should work.

Hope this helps.
Hi Thomas,

Welcome to Java Ranch.

Please copy paste the code below into a file named MainFrame.java
Try to compile and execute, it should work properly.
In the executed program, double click on any word in the text area,
this will cause a message to be displayed in the text box below
the text area.



Hope this helps.
20 years ago
Hi Thomas,

Welcome to Java Ranch.

Please copy paste the code below into a file named MainFrame.java
Try to compile and execute, it should work properly.
In the executed program, double click on any word in the text area,
this will cause a message to be displayed in the text box below
the text area.



Hope this helps.
20 years ago
Hi,

You need to add the j2ee.jar into your classpath. This jar is present in the j2ee download from sun and can be found in the lib folder of the j2ee installation directory.

Hope it helps
Hi,

I think your friend was talking about anonymous classes which can be declared and executed inside a method (no matter if it is done in main() method). Code snippet is given below:



Hope this clears the doubt.
20 years ago
Hi guys,

As we know calling sleep from any thread halts the execution of the given thread for a specific period of time without losing the monitor of the thread. On the other hand invoking Thread.yield() causes the currently executing thread object to temporarily pause and allow other threads to execute.

Now my doubt is

1.
Whehther calling Thread.yield() does not lose the monitor of the thread like the sleep() method.

2.
Does sleep(0) behave like Thread.yield(). That is does it return immediately like Thread.yield() after it has allowed other threads to execute.

Well regarding the second point i doubt that it works that way because as far as i know sleep method forces the thread to halt execution for a specific period of time during which other threads are allowed to execute.

What i want is this that without losing any monitor on any object that a thread holds i want that thread to relinquish control of the cpu so that other threads can execute. However if no threads are there to be executed then the control sould immediately return without any dealy.

In a nutshell i want a Thread.yield() behavior without losing any sort of object monitors that the concerned thread might be holding.

Any suggetions

Thanks in advance,
Hello Roney,
As far as i get it you have designed a java based application and want to run it on a client machine no matter whether a jre/jdk is installed or not. If this is the scenario in which you want to simply run the application without the client having to go through the hassles of installing the jvm then i think embedding the jre in your application is a suitable way out.
To embed a jre you have copy the jre folder in your machine into your local path and point the java home, class path, system path etc. to that directory so that the os can find the javaw.exe without any sort of trouble.
So, the installatio directory should look like:
<install>
|--- <jre>
| |--- bin
| |--- ...
|--- Your files...
in the startup script you can place commands like this.
set path=%path%;./jre/bin;
set classpath=%classpath%;.;./jre/lib/tools.jar;
.....
.....
javaw <your application>
Another approach is to use java based installers like exe4j etc. which make exe for java applications and enable you to run your code directly.
I hope it helps.
21 years ago
Hello Chris,
I was trying to make the machine as the server and the other remote machines connected to it through rmi.
In the begining i did'nt provide any sort of codebase and class server concept. It was then that the strange problem i mentioned above arised. However after i provided the codebase and the class server concept the problem got solved. So, not providing the codebase might have been the problem. But what is not clear to me as why the code behaved in such a way as it did in absense of the codebase and class server.
By the way, I am starting the class server from within my code, through the following code:
ClassFileServer cfServer = new ClassFileServer(port, classpath);
So at present the rmiregistry, class server and the remote object hosting everything is being taken care of by my code and all this happens in a single instance of JVM.
As far as the need of a class server is concerned i have observed the following behavior:
I modified the class server to show a message whenever a class file was requested from it. Now when i start rmi registry internally through locateRegistry.createregistry..... code then the rmi mechanism doesn't uses my class server at all. It seems that a class file is requested from the class server by the rmi mehansism only when i start the rmiregistry manually as a separate instance from the terminal.
Please explain this behavior.
Thanks in advance.
[ January 22, 2004: Message edited by: Vishal Sinha ]
21 years ago
Hello Chris,
Negative. The port is free and the problem persists with any other free port. The system simply hangs. No errors are thrown. The system simply hangs without any warning.
Strangely the problem got solved after i defiend a codebase and setup a dedicated class server for stub files. Although the problem is solved, but i don't understand what actually the problem was. Can you explain why using a class server solved the problem for me.
By the way i used the following code as my class server: ftp://ftp.javasoft.com/pub/jdk1.1/rmi/class-server.zip
Thanks in advance,
Vishal
[ January 21, 2004: Message edited by: Vishal Sinha ]
21 years ago
Hi guys,
I am facing a strange trouble in one of my software's installations. My software has a rmi server and the server dynamically creates a registry during run time at a port number specified by the user in the following way:
java.rmi.registry.LocateRegistry.createRegistry(port);
Now the problem is that the software is running quite well in 4 place different places. However in one client's installation there is a strange trouble. Actually the trouble is the first time my rmi server is executed it works well but on coming to the above mentioned line it hangs and the whole system seems to freeze. So we press Ctrl + Alt + Del and forcefully terminate the hanged server. Now here the strange thing starts. If again i execute the server for the second time it works normally without any hiccups.
This happens everytime the server is executed the first time after the computer starts up.
I don't understand how the same software can have different behavior in the same circumtance in the same computer.
By the way the configuration of the installation computer is
Windows 98
Celeron Processor
256 Mhz ram.
It also serves as a file and a print server.
Do you guys have any idea as to what is the reason behind this strage behavior ?
Thanks in advance.
21 years ago
Hi,
I noticed the above behavior of JComboBox. I tried the same approach but it didn't work.
21 years ago