sridevi kumar

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

Recent posts by sridevi kumar

1) diff between JVM and JRE:
JDK has JVM, JIT compiler, JFC, compiler, debugger, related tools and supporting files (libraries)
JRE has JVM, JIT compiler, JFC and supporting files
Is this correct?
2) what is JVM?
JVM executes your .class files (byte code which is platform independent) using java or javaw
is this correct?
3) diff between the exe files java and javaw?
a)
java executes non-gui program
javaw executes gui program
b)
javaw is identical to java but with one exception, there is no associated
console window with javaw...
When we use javaw, command prompt window won't appear.
However, if we are unable to launch for some reason, javaw will show a dialog box to display errors
c)
javaw is used when we want to run java application using icons (rather than in command window) in windows environment
(if this is true, then can't we use javaw in unix or in any other platform other than windows?)
please clarify whether my understanding is correct for questions 1 and 2
for question 3, please tell me which answer is correct... (whether a or b or c and also give definition for the exe files java and javaw)
Thanks a lot...
21 years ago
Thank you very much Corey McGlone for your reply.
I have scjp book for platform 1.2 (Complete Java 2 Certification Study Guide by Simon Roberts, Philip Heller, and Michael Ernest)...is this book enuf to read? or is there any book available for java 2 platform 1.4 by the same authors or by any other author?
please reply...
Hi:
I am planning to prepare for the SCJP exam...i have some core java experience...for which exam should i have to prepare (JAVA 2 PLATFORM 1.2 or JAVA 2 PLATFORM 1.4)
When i went thru exam topics, the topics JAVA.AWT PACKAGE, JAVA.UTIL PACKAGE, JAVA.IO PACKAGE are removed in JAVA 2 PLATFORM 1.4
Please advice which one will be easier to take and which one will give more value if we take?
Thanks a lot...if i have placed this question in a different forum (other than the forum specific for these kinda questions), pls forgive me and move this question to that forum).
hi all:
i have JTextField, JTable and JButton.
The tabbed order must be like this:
JTextField, JTable, JButton
How it behaves now:
When i press tab for the first time, the focus goes to JTextField. Again if i press tab, focus goes to JTable. But when i again press tab, the focus goes to next column...when i press tab again and again, it is always within JTable and it does not come out. The focus does not go to JButton at all.
If i extend JTable and override isFocusTraversable() to return false. I am getting the tab order behaviour like this: When i press tab for the first time, the focus goes to JTextField. Again if i press tab, focus goes to JButton. The focus does not go to JTable at all.
How do i want the implementation to be:
I want to implement like this: When i first press tab, the focus should go to JTextField. Again if i press tab, focus should go to JTable (first row, first column). When i again press tab, the focus should go to JButton. When the focus is in JTable, if i move arrow keys, it should move up/down within JTable but if i press tab, it should go out of JTable and it should go to JButton
Please help me...
Thanks a lot.
Sridevi
22 years ago
Thank u very much Greg Barish and Bosun Bello.
22 years ago
Thanks a lot Greg Barish.
Could u please tell me how to implement Comparable to sort the strings?
Thanks a lot again
22 years ago
Hi:
I want to sort an array list (project requirement)? Could anyone guide me how to do this?
Thanks a lot...
22 years ago
Once again, thank u very much dirk.
22 years ago
Hi Dirk:
Thanks a lot...
The problem is: I am using jdk 1.3...
Only from jdk1.4, that constructor is public...
I checked in 1.3 api. It is protected.
22 years ago
from the api:
protected Socket()
- Creates an unconnected socket, with the system-default type of SocketImpl.

1)
if i write a class as follows:
import java.net.*;
public class SocketDemo
{
private Socket m_objSocket; //line 1
public SocketDemo()
{
m_objSocket = new Socket(); //line 2
}
}
when i compile the above, i am getting the following error:
SocketDemo.java:31: No constructor matching Socket() found in class java.n
et.Socket.
m_objSocket = new Socket();
^
1 error

2)
if i write a class as follows:
import java.net.*;
public class SocketDemo extends java.net.Socket
{
protected Socket m_objSocket; //line 1

public SocketDemo()
{
m_objSocket = new Socket(); //line 2
}
}
when i compile the above, i am getting the following error:
SocketDemo.java:31: Can't access protected constructor of class SocketDemo. Instance creation is permitted only within the package in which the constructor is defined.
m_objSocket = new Socket();
^
1 error

Could someone help me how to use the constructor "new Socket()" in java.net.Socket?
22 years ago
Thanks a lot for ur replies
22 years ago
I have a doubt in calling the method...in java, it is call by value.
Is there any way to pass a character array in a method as a parameter and the called method should modify this parameter and the modified value must be reflected in the caller... Please help me.
For example:
void methodA( char[] reply )
{
/*this method shd modify the reply and the modified value must be reflected in the calling method*/
}

void methodB()
{
char[] data = new char[256];
methodA( data );
System.out.println( "data: " + data );
}
22 years ago
Hi:
I am trying to implement JNI in HP-UX 10.20. We are using jdk1.1.8.
I am getting UnsatisfiedLinkError even though i set the library path.
Please go through the following steps:
1) The .java file is as follows:
class ShipInterface
{
public native int getCPPObjPointer();
public native String parseShipRequest(String strRequest, int ptrShip);
static
{
System.loadLibrary("ShipServer");
}
//other methods...
}
2) I complied this .java file using javac
3) javah -jni ShipInterface
4) Actually, the following java class invokes the native methods
public class ShipServer
{
ShipServer()
{
String strRequest = "parse this request";
ShipInterface m_objShipInterface = new ShipInterface();
int ptrShip = m_objShipInterface.getCPPObjPointer();
String strReply = m_objShipInterface.parseShipRequest(strRequest, ptrShip);
}
}
5) Now .cpp file (the name of the file is ShipServer.cpp)
#include <jni.h>
#include "ShipInterface.h"
#include <stdio.h>
class MyShip
{
public:
MyShip(){}
char* parseRequest(const char* strRequest)
{
char* strReply = "Return this reply";
return (strReply);
}
};

JNIEXPORT jint JNICALL Java_ShipInterface_getCPPObjPointer
(JNIEnv * jEnv, jobject jObj)
{
MyShip *objMyShip = new MyShip();
return( (jint) objMyShip);
}
JNIEXPORT jstring JNICALL Java_ShipInterface_parseShipRequest
(JNIEnv * env, jobject obj, jstring strInput, jint ptr)
{
//convert java type 'String' to C++ type 'char *'
const char * strRequest = env->GetStringUTFChars(strInput, 0);
MyShip *objMyShip = (MyShip *)ptr;
char * strReply = objMyShip->parseRequest( strRequest );
env->ReleaseStringUTFChars(strInput, strRequest);
return env->NewStringUTF(strReply);
}
6) Now, i had compiled .cpp as follows:
g++ -fpic -shared -c -I/opt/java/include -I/opt/java/include/hp-ux
ShipServer.cpp
7) Now, i had created the shared library as follows:
/usr/ccs/bin/ld -b -o ShipServer.sl ShipServer.o
8) Now, i had set the library path as follows:
export SHLIB_PATH=/home/Java:$SHLIB_PATH:
[Note 1: The directory /home/Java contains the .sl file ]
[ Note 2: For hp-ux, we need to set SHLIB_PATH but not LD_LIBRARY_PATH]
9) When i try to execute ShipServer.class file (by issuing the command
jre ShipServer ), i am getting the following error:
java.lang.UnsatisfiedLinkError: no ShipServer in shared library path
at java.lang.Runtime.loadLibrary(Runtime.java)
at java.lang.System.loadLibrary(System.java)
at
at ShipServer.main(ShipServer.java:313)
Note 1: Even though, i had set the library path, i am getting this error.
Note 2: I had also tried to set the library path as follows:
export LD_LIBRARY_PATH=/home/java:$LD_LIBRARY_PATH:
Could you please help me to resolve this problem?
Your help would be highly appreciated...
22 years ago
Hi:
I am trying to create a shared library in HP Unix 10.20.
I gave the command like this:
g++ -o test.so -shared -I/opt/java/include -I/opt/java/include/hp-ux test.cpp -static -lc
I had included /opt/java/include bcoz it has jni.h
and i had included /opt/java/include/hp-ux bcoz it has jni_md.h
When i tried to create a shared lib (by issuing the above command), it throws the error message as follows:
/usr/ccs/bin/ld: DP relative code in file /var/tmp/ccaGpcIE.o - shared library m
ust be position
independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
Could anyone please help me to solve this?
Thanks a lot.
22 years ago