Alf Fernandez

+ Follow
since Sep 01, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alf Fernandez

I�m using the Tomcat Web Server v4.0, to test the examples, in order to study to the scwcd.
But it not allow automatically reload of the servlets, when they change. And is very tedious to stop and start the web server, when I modified a class.
Is there any free Web Server, that supports automatic reload of the servlets?
I wrote a small MQ/Java program, which I encapsulate in a jar file.
If I include in the jar the classes, it works fine. But if I include only the classes that I have wrote, it launches de following exception, when run it:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQException
Im sure the PATH and CLASSPATH are ok, because if I execute:
javap com/ibm/mq/MQException
it shows all the methods of the class.
Some help will be apreciated. Thanks
19 years ago
I am trying to access some java classes, from Visual C++ 6.0, using JNI. The program compiles and links fine, but when I run it, in the JNI_CreateJavaVM call, returns -1
I don�t know, how can debug it, to find out what the problem is. The jvm.dll is in the project directory, the O.S. is Windows 2000 Professional and the JDK version 1.4
JNIEnv *env;
JavaVM *jvm;
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jclass stringClass;
jobjectArray args;

JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString = "-Djava.class.path= USER_CLASSPATH";
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;

/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

Some help will be apreciated
20 years ago
it can also be final and thow exceptions
... and ... if Anuji understood the answer .... that is a '''GOOD EXAMPLE'''
Well.... you know .... an example is only an example ....
Por la respuesta que das, no se si es que no te has leido la pregunta que hacia anuji, o es que estas contestando a otra distinta
... well, i will explain you with an example...
Suppose I create an interface, named Vehicle, that define the behavior that the clases implement it, could have.
public interface Vehicle{
void openDoors();
void turnOn();
// more methods
Then I write a documentation, explaining that the methods should do. In the 'openDoors()' method, I say: 'this method is optional', because there are vehicles, that doesn�t have doors
Now, you create two clases, implementing the interface: 'Car' and 'Bike'
public class Car implements Vehicle{
void openDoors(){
//some stuff here
void turnOn(){
//some stuff here
public class Bike implements Vehicle{
void openDoors(){
throw new UnsupportedOperationException();
void turnOn(){
//some stuff here
In the Bike class, the method 'openDoors()', heve no sense, since the bikes have no doors. But because the Java languaje rules, you have to implement every method of the interface, so in the Bike class you throws an exception, while in the Car class, does something.

A non abstract Class that implements an interface, must provide a body for every method of the interface
I supposed that your question, is because in the API documentation from Sun of the Collection Clase, there are several methods where Sun said that are optional (optional operation)

For example, the method add() is optional, but you have to implement it. If the class that u are creating, not support this method, you will have to throw an exception (UnsupportedOperationException), when the method is called.
The size of the array you has declares, is 10 (int size = 10; int[] arr = new int[size]
And the for loop, goes from the first element to the last (the first element of an array is 0, and de last, is array.length minus one)
for (int i = 0 ; i < 10 ; ++i)
So, it prints the contents of the array, that are 10 ceros.
[The above code prints 0 ten times.Shouldn't it print 0 only nine times.Any comments/suggestions]

Well, to create a reference of the type of the Inner class, you only need to specify the name of the Inner, 'if you are into the Outer class':
Inner inner;
But if you were outside the Outer class, you will need the long form:
Test009.Inner inner;
You better study C#..... Java is only for intelligent people.
You better study C#..... Java is only for intelligent people.
20 years ago