qionghua yang

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

Recent posts by qionghua yang

Window NT with Informix database. How about you?
qionghua
Hi there,
I would like to convert a String variable to the java.sql.Clob datatype:
My code looks like this:
String streamHTML = (out.toString());
Clob outHTML = (Clob)streamHTML;
And of course, this code doesn't work. Hope you can help me.
Thanks a lot.
qionghua

23 years ago
Hi there,
I would like to convert a String variable to the java.sql.Clob datatype:
My code looks like this:
String streamHTML = (out.toString());
Clob outHTML = (Clob)streamHTML;
And of course, this code doesn't work. Hope you can help me.
Thanks a lot.
qionghua
How about the second class? Does the javadoc ignore it?
Actually I think I use
javadoc.exe -private
to get all the private members and class document.
Thanks!
qionghua
24 years ago
Hi there,
I have two classes (First and Second) inside one java file. I could not get the documents for the second class when I used the javadoc command. I am wondering if I need to do some specifial work for this class. Also, I can't get any documents for my member variables.
My code looks like this:
/**
* First class document
*/
public class First{
/**
* memeber variable document
*/
private String s;

.........
}
/**
* Second class document
*/
class Second {
..............
}
Thanks!
qionghua
24 years ago
Hi,
There are two ways to do that.
1)You need specify the class name which contains the main
method.
java -jar myjar.jar mainclass
2)Use a manifest file when you jar you java files.
jar cvfm myjar.jar manifest.mf *.class
Hope this helps.
qionghua
24 years ago
Thanks Cindy.
Now I can get it by using the following code. But does that mean I always need to
************************************************************
Properties p = System.getProperties();
System.out.println(p.getProperty("java.class.path"));
************************************************************
But when I use this
System.out.println(p.getProperty("java.path"));
System.out.println(p.getProperty("HOMEPATH"));
the value is null. Does that mean I always need to use "java...." as my key?
How can I get the system variables in Settings->Control Panel->System->Environment?
Thanks!
qionghua
24 years ago
Hi,
I would like to get the properties in the System, such as CLASSPATH and PATH. But when I used the following code, it always return null to me. Please help.
Properties p = System.getProperties();
System.out.println(p.getProperty("CLASSPATH"));
Thanks!
qionghua
24 years ago
sorry, I used my old Id again.
24 years ago
Hi Cindy,

Wow, finally I got it. It works perfect now. Thanks a lot cindy. You have been such a great help to me. I really appreciate it. I know it is very easy to get confused. Even myself gets confused. But now I try your strategy and suddenly everything is so clear to me.

Thank you so much.
qionghua
24 years ago
Hi Cindy, thanks a lot for your help. We made a batch file to show the manifest file, make the jar file and run the jar file. Notice that I have made some changes in my file structure. I have adopted your suggestion in my file struture. So I have all the class files in D:\Javadevel\hipPocket\application\package01 directory. I create the Meta-Inf subfolder for manifest file.
And here is the result of the batch file. It looke like I am still missing something very simple here.
***************************************************************
> cd D:\JavaDevel\hipPocket\application
> BatchMain6.bat

D:\JavaDevel\hipPocket\application>BatchMain6.bat
D:\JavaDevel\hipPocket\application>rem this file is: d:\JavaDevel\hipPocket\application\BatchMain.bat
D:\JavaDevel\hipPocket\application>rem ----- ----- current working directory is ...application
D:\JavaDevel\hipPocket\application>rem ----- ----- locate the jar file in .
D:\JavaDevel\hipPocket\application>rem ----- ----- use: .\meta-inf\package01.startTwo.mf
D:\JavaDevel\hipPocket\application>rem -----show that the program works using the class files
D:\JavaDevel\hipPocket\application>C:\JBuilder4\jdk1.3\bin\java.exe -cp .\package01 Two
*******************WORKS Springfield
D:\JavaDevel\hipPocket\application>rem -----show the manifest file
D:\JavaDevel\hipPocket\application>type .\meta-inf\package01.startTwo.mf
Main-Class: package01.Two
D:\JavaDevel\hipPocket\application>rem -----build the archive file (jar) using .\meta-inf\package01.startTwo.mf
D:\JavaDevel\hipPocket\application>C:\JBuilder4\jdk1.3\bin\jar.exe cvfm .\Package01.jar .\meta-inf\package01.startTwo.mf package01\*.class
added manifest
adding: package01/One.class(in = 1437) (out= 760)(deflated 47%)
adding: package01/Two.class(in = 862) (out= 493)(deflated 42%)
D:\JavaDevel\hipPocket\application>rem -----show the contents of the jar file
D:\JavaDevel\hipPocket\application>C:\JBuilder4\jdk1.3\bin\jar.exe tf .\Package01.jar
META-INF/
META-INF/MANIFEST.MF
package01/One.class
package01/Two.class
D:\JavaDevel\hipPocket\application>rem -----two tries: run the main program using the jar file
D:\JavaDevel\hipPocket\application>C:\JBuilder4\jdk1.3\bin\java.exe -jar -cp . .\Package01.jar
java.lang.NoClassDefFoundError: package01/Two (wrong name: Two)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
Exception in thread "main"
D:\JavaDevel\hipPocket\application>C:\JBuilder4\jdk1.3\bin\java.exe -jar -cp .\package01 .\Package01.jar
java.lang.NoClassDefFoundError: package01/Two (wrong name: Two)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
Exception in thread "main"
Thanks for your help. I really appreciate it.
qionghua

24 years ago
Thanks Cindy.
What do you mean classpath? Do I need to specify the classpath when I run the jar file? How to?
And in fact, I don't have another subfolder to hold the manifest file only. I put the manifest in the same directory as the class files. What is the advantage of using a separate subdirectory for the manifest file?
Thanks!
qionghua
24 years ago
Yet, I agree with Cindy. I have used ArrayList before and I think it is very nice. You can get those nice methods like the size(), get(i), etc.
qionghua
24 years ago
Hi joel,
Try replacing "return clientInfo[][];" with
"return clientInfo; "
Hope this helps.
qionghua
24 years ago
Thanks cindy. I have tried it but it seemed I didn't get any luck on that. This is what I did.
1) I created the Manifest.mf on D:\project\class\;
2) In D:\project\class, Jar all the class files under package01 using the following command:
jar.exe cvfm application.jar Manifest.mf -C package01/ .
This will place the application.jar file under class directory.
3) Run jar file under D:\project\class:
java.exe -jar application.jar
Thanks!
qionghua
24 years ago