This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

skip coon

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

Recent posts by skip coon

Hey there,

I know that java-1.4.2 does not have such great support for the ALSA sound system. So you may want to give java-1.5 a shot.

Hope this helps,


scoon
16 years ago
Hey thanks alot.


scoon
Hey all,

Does Eclipse have a GUI template kit similar to Sun's Java Studio Creator ?


Skip Coon
S.C.J.P
Hey All,
I am running xorg-x11 for my X server. I am using C for the native calls. I am quite certain that the C-code that I have written works just fine on it's own but when I compile to a shared library and use it with java, I get this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/scoon/Desktop/JNI/X11/libcX11.so: /home/scoon/Desktop/JNI/X11/libcX11.so: undefined symbol: XOpenDisplay
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at jX11.<clinit>(jX11.java:4)


I compile my shared library using these 2 steps:

gcc -I$JAVAHOME/include -I$JAVAHOME/include/linux -I/usr/X11R6/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/X11R6/include -L/usr/X11R6/lib X11_Imp.c -c -o libcX11.o

ld -shared -o libcX11.so libcX11.o


I think this is an include problem, so I am wondering if anyone has had any experience w/ this?

Thanks in advance,
scoon
16 years ago
Add another one to the SCJP pile, passed today!!!
17 years ago
Hey there,
I know that is what you get when you try to run javac with the '-source' tag. I just wanted to see the output of your shell when you just type javac. Like so:
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
Hey there,

In your reply you used java in the shell window, not javac. try that and see what is displayed.

scoon
hey there,
An easy way to double check what options your javac has just type javac in your shell. A list of options will then be displayed:
I am running:
java version "1.4.1_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)
ie:
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options

I hope this helps.
scoon

Originally posted by Marco Tedone:
I'm studying the operators and assignments and i have a couple of questions:
1. The author says that implicit narrowing primitive conversions on assignment can occur when the source is an int constant whose value can be determined to be in the range of the destination type at compile time. He also says that the type could be either byte, short or char. In its example the author states that:
byte tiny = (byte) 128; //This because int value is not in range. What does it mean? Is not in range because between byte and int is there short or because of the value?
2. The author says that an int negative value is not determinable and therefore a cast is required, referring to the following example:
int i = -20;
byte b2 = (byte) i; //Value of i not determinable
Why this value is not determinable?
Regards,
Marco
:roll:


Hope this helps:
The different primative types in Java have what is known as different bit depths (ie: the bit size of the type).
To illustrate:
byte 8-bit signed
short 16-bit signed
int 32-bit signed
long 64-bit signed.
To answer your quetion 1. The problem is not with the value or the fact that there is a type between byte and int. The problem is that if you cast an int(32 bits) to a byte(8 bits) without letting the JVM know, explicitly cast, the JVM will complain about "possible loss of precision". If you do this: int i = 20; byte b = (byte)i; You are telling the JVM that you understand that there will be precision loss and you still want to make that assignment. As a result, the compiler makes the conversion for you.
For question 2: I am running v1.4.1 of the JVM under linux. If I do this: int i = -20; long l = i; I get no conversion error.
If I do this: int i = -20; byte b = (byte)i; I get no conversion error.
If I do this: int i = -20; byte b = i; I get a conversion error.
So I guess, in a long winded sort of way, I do not have an answer for your second question.
Hope this helps.

scoon
Hi all. I have been studying for the SCJP 1.4 exam for a bit and have been using the sybex mock test. I was wondering if anyone else has tried them and would like to know what they think of them.
Thanks,
scoon
thank you. that helps a bunch.
thank you for the response.
how about if either is "is-a" or "has-a" relationship?

thanks, again.
A thread can be created 2 ways: either subclassing (extends) or implement Runnable. What is the difference between the two? Why choose one method over the other? Is there a "is-a" or "has-a" relationship with either of these?
I have been thinking about this for a bit and I just don't know the answer.
Thank you all for your time.
-> scoon