RE: NoClassDefFoundError and RH6.0
Hi Greg, everyone, On Thu, 30 Sep 1999, Roll, Greg wrote: > Actually yes Is this incorrect? I'm fairly new to the Java thing > but I compile fine with the same steps on a Solaris machine. > > GR > > From: Chris Abbey [mailto:[EMAIL PROTECTED]] > > you didn't by any chance type "java HelloWorld.class" did you? The argument to java should be just the class name, thus: java HelloWorld . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JDBC problem!
Hi Alpesh, everyone,
On Wed, 29 Sep 1999, ALPESH KOTHARI wrote:
> I have written one program in java2 to write the data
> in postgresql. I am storing one integer and one string
> in the database. When i read the string from the file
> it is proper. But when i store it, it gives the
> following exception:
> java.sql.SQLException: ERROR: parser: parse error at
> or near ""
>
> I am not able to detect the error. Can any one run the
> code and correct the problem?
> When I assign the string test1 some fixed value and
> store it then the program works fine.
^^
This should give you a clue. This has *nothing* to do with JDBC, rather
your code to read the string from the file is incorrect! And also, your
code to write the string to the file is incorrect.
> Here is the code:
...
> pid1=din.readInt();
> System.out.println(pid1);
> int len1=din.readByte();
> byte[] lent=new byte[len1+2];
> for(int i=0;i<=len1+1;i++)
> {
> lent[i]=din.readByte();
insert here: System.out.print(lent[i]); System.out.print(" ");
> }
> test1=new String(lent);
> System.out.println(test1);
...
First of all, you can see that your loop is wrong. If len1 is the length
of the string, then the loop should read i < len1 NOT i<=len1+1, and the
byte array should be byte[] lent=new byte[len1].
Second of all, if you insert the print statements I note above, you will
find out that you have binary characters in your string! THis is what is
causing postgres to barf. Most likely, you have a hidden null or a
control character in it, which is why printing it doesn't show up.
I bet you used DataOutputStream.writeUTF() to write the string to the test
file in the first place. On a unix system, try looking at the output
using "od -c". On a Windows system, use a binary editor to look at the
test file. writeUTF() actually puts an int indicating the length of the
string first.
So instead of writeUTF() or whatever you're using, use
DataOutputStream.writeBytes() instead.
Or conversely, use readUTF() to read it back.
. . . Sean will charge you for the next question =)
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
RE: NoClassDefFoundError and RH6.0
On Thu, 30 Sep 1999, Roll, Greg wrote: > That still yields the same error... I tried that many times too! Sorry, I didn't catch your first email. If it still says class not found, make sure you have CLASSPATH set correctly. Also make sure your PATH is set to include the bin directory under the directory you installed your JDK, *as the first thing in your PATH*. Assume you have your JDK installed in /tmp/jdk. Assume you have your HelloWorld program in /home/groll. Then you need to make sure you have done these steps (under bash): export PATH=/tmp/jdk/bin:$PATH export CLASSPATH=/home/groll:$CLASSPATH Then you can run: java HelloWorld You will want to read up on using Linux and also read up on the CLASSPATH mechanism in Java. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JDBC problem!
On Thu, 30 Sep 1999, ALPESH KOTHARI wrote:
> Hello,
>
> What you told is perfectly true. But in my case it is
> a different story! When I read only characters then
> also it create the problem. To rectify it I have
> modified my program and now I am reading only few
> characters from the file(i.e. not going till end of
> file). Then also the same problem persists.
No, it is the same story.
Look here:
int len1=din.readByte();
System.out.println(len1);
byte[] lent=new byte[len1+2];
^^
for(int i=0;i<(len1-3);i++)
{
lent[i]=din.readByte();
System.out.print(lent[i]);
System.out.print(" ");
}
Your code is incorrect. To read in len1 bytes, your array only needs to
be exactly that long. Java is not C/C++.
Your code should read:
byte[] lent=new byte[len1];
for (int i=0; i < len1; i++)
Then things will work perfectly.
As Wei points out in another message, if you allocate a longer array, the
other parts of the array are filled with null bytes. When converted to
a String, the string gets null characters in it which will choke
Postgresql.
That'll be US$20 =)
. . . Sean.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Jar file Access to images
On Mon, 18 Oct 1999, Robert Simmons wrote: > I have an application that I intend to package as a jar, with its images in > the Jar. How do I construct a URL object to load those images into IconImage > instances from the LOCAL jar file (ie, the file the program is running in.) > Further, is there a generic way I can have it load from either the > subdirectory, if the app is not run from a jar, such as when Im doing > interim builds during programs, and from the jar in a distribution. Class.getResource(), Class.getResourceAsStream() will do what you want, if your images are in the same JAR or directory as your class files. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Segmentation Fault (JDK12pre2/AWT/RedHat6.0)
Hi Matt, Sounds suspiciously like you have the wrong jdk1.2pre2 version. Make sure you get the version for glibc2.1. Other than that, you might want to disable the JIT and run green threads: java -green -Djava.compiler= . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Version snag
Hi everyone, On Mon, 25 Oct 1999, Hartnett wrote: > This same package was installed on Solaris and its runtime and works > fine. > > This group seems to be quick to jump on someone if it is not JAVA Linux > related in someone's opinion. I am running Blackdown JAVA 2 on Red Hat > Linux 6, that sounds like this group to me. I don't see what the problem > is? I thought the idea of this list is to try to help others, not to > try to make someone want not to use these products? I don't think Dustin was really jumping on you, he tried to give you a possibility which is what you asked. Unfortunately, Dustin's suggestion isn't quite right either I think as JDK1.2pre2 reports a java.version of "1.2" as expected. We won't be able to help you any further unless you can tell us what exactly your program considers to be Java 1.2. Also, did you check that the generated scripts point to the correct JVM? . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: mailto-protocol and it´s result: UnknownHostExceptionmailhost or ConnectionRefused
Hi Christian, everyone, On Tue, 26 Oct 1999, Christian Kruggel wrote: > Hi Juergen! > > A few days ago you answered my question concerning java´s > mailto-protocol and the exception produced by the appended source: > > java.net.UnknownHostException: mailhost > >Juergen> Sounds like a setup problem. Can you ping mailhost? > > No. Another nice GUY suggested to mention the localhost as > mailhost in /etc/hosts. Appending the line "127.0.0.1 mailhost" > I was able to ping the mailhost. But that seems just to shift > the problem. Executing the program now leads to a > ConnectionRefused-Exception ... Er, you're supposed to replace "mailhost" with the name of your actual SMTP server. You shouldn't be messing around with /etc/hosts. You can get your SMTP server from your browser settings or email client settings. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: mailto-protocol and it´s result: UnknownHostExceptionmailhost or ConnectionRefused
To clarify: As the usage in the program says, you're supposed to run the program like this: java SendMail As Juergen said, evidently you are not specifying the correct server name so it defaults to "mailhost" which doesn't exist for you. It probably worked on the Sparc 5 because the SMTP mail service was probably running on it, whereas from your email it's evident that no mail service is running on your Linux machine. Please email privately if you have further problems, this is getting off-topic. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Problems with an external library which use pthread
Hi Stephane, everyone, On Thu, 28 Oct 1999, Stephane Letz wrote: > I'm trying to port a C library which use pthread with the Blackdown JDK > 1.1.7 on Linux. Bad idea. All pthread implementations I know of, along with green threads in the JDK, and native threads, mess around with the signal handlers. It would be a big undertaking to make everyone happy. Your best bet would be to change the pthread code to use native threads, which is Posix compatible anyway and discard the other pthread library. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Problems with an external library which use pthread
Hi Nathan, everyone, On Thu, 28 Oct 1999, Nathan Meyers wrote: > Something in this mail sounds like a disconnect. The pthread API > implementation bundled with current Linux releases (it actually comes > as part of glibc) uses the native Linux threading facility... it's what > the JDK itself uses to get native threading. We cleared it up off-list. From his email I thought he was using some other pthread library because of the way he worded it, but he's using the glibc pthread just the same as the native JDK. Evidently the 1.1.7v3 native threading is still a bit broken because his simple test program doesn't work. It works on the IBM JDK 1.1.8 but other problems occur there. I've pointed him to the the beta JDK 1.2, which has better native threading. But in any case, none of the native threads implementations are exactly mature yet so I'm unsure how much success he will have. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Java 2D on Linux - font weirdness
Hi, Robbie, everyone, On Wed, 27 Oct 1999, Robbie Baldock wrote: > I'm having a weird problem with a GIF-generating Java 2 app I'm > running on Linux. I'm calling the Java app from a Perl script (don't > ask!) with a line like: > > system "java XYZ myarguments"; > > When I run this from the command line it works perfectly > (generating a graph with text labels in GIF format) but when I run > exactly the same script as a CGI script from a web-page it > generates the same image but the text is all in a Greek font! > > Obviously, this is something to do with the environment the > Perl/Java code is running in. Has anyone come across anything > like this before? Evidently, your program is accessing fonts through the X server when you run it normally. Since the perl/CGI environment doesn't have such access, the JVM reverts to whatever fonts it can get to. That's my best guess at what's happening. You might want to double check your font setup there. One possible solution is to use xvfb, which is a fake X server that can be accessed by server-side Java programs. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: off topic (code problem)
On Tue, 2 Nov 1999, Yohans Mendoza wrote:
> here's the piece, plese help
>
> public STable(Vector fieldsv, Vector rowsv)
> {
> originalRows = (Vector)rowsv.clone();
> rows = (Vector)rowsv.clone();
> ...
> }
> now, the problem is that when rows changes originalRows changes too.
> the parameter is a vector of vectors, so I'm guessing that's messging
> things up, right?
You need to clone every element in the Vector also. By default, Vector's
clone() only does a shallow copy, whereas you seem to want a deep copy.
Remember that Java uses a reference data model, so when you clone the
Vector, the second vector "rows" has copies of the references from the
first vector "originalRows", but the references STILL point back to the
original objects in "originalRows". Thus, adding or removing elements
from the cloned vector will work as expected, but changing the actual
elements in the vector will affect the original.
A basic Java mailing list such as those hosted by Sun or the Java
newsgroups will be more helpful here.
. . . Sean.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ibm jdk 118 and apache jserv
Hi Aaron, everyone, On Thu, 4 Nov 1999, Aaron M. Stromas wrote: > having read how fast the ibm's jvm is i decided to compile apache jserv > with it. unfotunately, i was getting a library load errors, "unsatisfied > symbol: __bzero" in libjava.so. the old trick of defining macro bzero in > term of memset didn't work this time. what would be the least intrusive > way of getting over this annoyance, perhaps, adding a to libjava.so a > sourrce with the macro defining bzero? > besides, i should not have to do that at all, it must be somehow > resolved, otherwise it wouldn't work, period. > any suggetions? tia, You have to upgrade your glibc, to 2.1 I believe. Read the requirements for the ibm jdk118. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: What JDK version can run j2ee?
Hi all, On Wed, 10 Nov 1999, Nathan Meyers wrote: > On Thu, Nov 11, 1999 at 12:25:14PM -, [EMAIL PROTECTED] wrote: > > Hi, all: > > On Sun's site, I find to run j2ee must under jdk 1.2.2, but > > on linux, the blackdown jdk version is jdk1.2prev2, how this version > > compare to jdk1.2.2? Who can tell me, how to run j2ee on linux? > > The Blackdown JDK is a pre-release of JDK1.2, not JDK1.2.2. If you have > dependencies on JDK1.2.2, the current Blackdown version won't help. I > believe there are some efforts to get 1.2.2 ported, but nothing has > been announced. Not only that but the J2EE uses RMI over IIOP, which requires a native library currently only available for Windows and Solaris. I know, I tried to get it to run. Just so you know. You could conceivably take that bit out as the rest should be pure Java, but that would be tricky. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: A Java parser
On Wed, 17 Nov 1999, Kontorotsui wrote: > Suppose I want to do a tool that parses the java code and modifies it. > > What do you advice me to use? Are there java parsers for Linux? > If the answer is negative, what can I use? Perl (*groan*)? www.antlr.org is a Java parser/lexer suite that comes with a grammar for Java. There's also a tool (which I don't have the URL handy at the moment) which allows you to extend the Java language fairly easily. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: linux port of JSDK2.0 ?
On Wed, 17 Nov 1999 [EMAIL PROTECTED] wrote: > I'm looking, but I don't see a linux port of JSDK2.0. JSDK1.0 is > avaliable from javasoft but the 2.0 version is only avaliable to win and > solaris. > > Has anyone found a way to use this 2.0 version on linux? Yes, just download the version for Solaris. It's a .tar.Z file so it can be uncompressed and unarchived on Linux, and everything in there is pure Java. . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Java inlining
Hi, I found my link to the Java preprocessing mechanism, it's called OpenJava. Don't know if it will be any use to the original poster, but I'll throw it out here in case it is: http://www.hlla.is.tsukuba.ac.jp/~mich/openjava/ . . . Sean. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
