Sign in to follow this  
shanenin

Send Info Out Of Machine

Recommended Posts

What package is javac part of? I thought is was part of sun-jdk, but I don't think I have that pachage installed. Is javac part of the runtime?

Edited by shanenin

Share this post


Link to post
Share on other sites

my javac was coming from blackdown-jdk-1.4.2.02. That was causing my confusion. I am installing sun-jdk in its own slot now. Does that also contain the runtime? It should not matter, I already have the runtime installed.

Share this post


Link to post
Share on other sites

Probably. IIRC it's default JRE/JDK because of Sun's licensing.

Share this post


Link to post
Share on other sites

I am trying to use java-config to change to the sun-jre-1.5

below are the listings of my two java directorys

mainbox opt # ls sun-jdk-1.5.0.06/bin/
ControlPanel jarsigner javaws jstack native2ascii serialver
HtmlConverter java jconsole jstat orbd servertool
appletviewer java-rmi.cgi jdb jstatd pack200 tnameserv
apt javac jinfo keytool policytool
extcheck javadoc jmap kinit rmic
idlj javah jps klist rmid
jar javap jsadebugd ktab rmiregistry
mainbox opt # ls sun-jre-bin-1.5.0.06/bin/
ControlPanel javaws klist pack200 rmiregistry
java keytool ktab policytool servertool
java_vm kinit orbd rmid tnameserv

when I try to set sun-jre-1.5 it gives me an error of not findong javac. Am I suppoed to copy it over from my jdk bin?

mainbox opt # java-config --set-system-vm sun-jre-bin-1.5.0.06
javac not found at /opt/sun-jre-bin-1.5.0.06/bin/javac or /opt/sun-jre-bin-1.5.0.06/jre/bin/javac
javadoc not found at /opt/sun-jre-bin-1.5.0.06/bin/javadoc or /opt/sun-jre-bin-1.5.0.06/jre/bin/javadoc
jar not found at /opt/sun-jre-bin-1.5.0.06/bin/jar or /opt/sun-jre-bin-1.5.0.06/jre/bin/jar
rmic not found at /opt/sun-jre-bin-1.5.0.06/bin/rmic or /opt/sun-jre-bin-1.5.0.06/jre/bin/rmic
THIS SYSTEM VM IS NOT SUFFICIENT, REQUIRED BINARIES WERE NOT FOUND

Share this post


Link to post
Share on other sites

I was studying this simple server/client pair

server

# simple illustration client/server pair; client program sends a string
# to server, which echoes it back to the client (in multiple copies),
# and the latter prints to the screen
# this is the server
import socket
import sys

# create a socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# associate the socket with a port
host = '' # can leave this blank on the server side
port = int(sys.argv[1])
s.bind((host, port))

# accept "call" from client
s.listen(1)
conn, addr = s.accept()
print 'client is at', addr

# read string from client (assumed here to be so short that one call to
# recv() is enough), and make multiple copies (to show the need for the
# "while" loop on the client side)
data = conn.recv(1000000)
data = 10000 * data

# wait for the go-ahead signal from the keyboard (shows that recv() at
# the client will block until server sends)
z = raw_input()

# now send
conn.send(data)

# close the connection
conn.close()

and now the client

# simple illustration client/server pair; client program sends a string
# to server, which echoes it back to the client (in multiple copies),
# and the latter prints to the screen
# this is the client
import socket
import sys

# create a socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# connect to server
host = sys.argv[1] # server address
port = int(sys.argv[2]) # server port
s.connect((host, port))

s.send(sys.argv[3]) # send test string

# read echo
i = 0
while(1):
data = s.recv(1000000) # read up to 1000000 bytes
i += 1
if (i < 5):
print data
if not data: # if end of data, leave loop
break
print 'received', len(data), 'bytes'

# close the connection
s.close()

from the doc I read, it said the while loop in the client does the following

Lines 22ff: The client reads the message from the server. As explained earlier, this is done in a loop, because

the message is likely to come in chunks. Again, even though Line 35 of the server gave the data to its OS in

one piece, the OS may not send it out to the network in one piece, and thus the client must loop, repeatedly

calling recv().

That raises the question of how the client will know that it has received the entire message sent by the server.

The answer is that recv() will return an empty string when that occurs. And in turn, that will occur when

the server executes close() on Line 38

I am not understaning what this part of the loop is doing

i += 1
if (i < 5):

It seems to be causing it only to print only the first 5 loops, is that nessesary to getting the whole string sent. The code seems useless(that is why i thnk I am not understanding it)

Edited by shanenin

Share this post


Link to post
Share on other sites
I am trying to use java-config to change to the sun-jre-1.5

below are the listings of my two java directorys

mainbox opt # ls sun-jdk-1.5.0.06/bin/
ControlPanel jarsigner javaws jstack native2ascii serialver
HtmlConverter java jconsole jstat orbd servertool
appletviewer java-rmi.cgi jdb jstatd pack200 tnameserv
apt javac jinfo keytool policytool
extcheck javadoc jmap kinit rmic
idlj javah jps klist rmid
jar javap jsadebugd ktab rmiregistry
mainbox opt # ls sun-jre-bin-1.5.0.06/bin/
ControlPanel javaws klist pack200 rmiregistry
java keytool ktab policytool servertool
java_vm kinit orbd rmid tnameserv

when I try to set sun-jre-1.5 it gives me an error of not findong javac. Am I suppoed to copy it over from my jdk bin?

mainbox opt # java-config --set-system-vm sun-jre-bin-1.5.0.06
javac not found at /opt/sun-jre-bin-1.5.0.06/bin/javac or /opt/sun-jre-bin-1.5.0.06/jre/bin/javac
javadoc not found at /opt/sun-jre-bin-1.5.0.06/bin/javadoc or /opt/sun-jre-bin-1.5.0.06/jre/bin/javadoc
jar not found at /opt/sun-jre-bin-1.5.0.06/bin/jar or /opt/sun-jre-bin-1.5.0.06/jre/bin/jar
rmic not found at /opt/sun-jre-bin-1.5.0.06/bin/rmic or /opt/sun-jre-bin-1.5.0.06/jre/bin/rmic
THIS SYSTEM VM IS NOT SUFFICIENT, REQUIRED BINARIES WERE NOT FOUND

I have my jdk set as default, the jre doesn't include javac, but the jdk includes the jre.

Share this post


Link to post
Share on other sites
I bet when I emerged azureus the blackdown version of java was installed.

For future reference azureus doesn't build with a 1.5 jdk so you will have to revert to blackdown to re-build it if necessary.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this