May I have a little assistance?

I have compiled my source code successfully and the program needs a main method.
I have tried to add:
public static void main(String args[]){ into my program. It gives me errors. I don't know where to put it. I cannot run the program without it. I have to add it into a couple of class files and I'll only post one of the source codes up. I use JBuilder 8 to organize my code.
Here is the code:
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
public class socketapplet extends JFrame
//int character;
//Socket socket = new Socket("216.179.96.7", 80);
//InputStream in = socket.getInputStream();
//OutputStream out = socket.getOutputStream();
//String string = "Hello\n";
//byte buffer[] = string.getBytes();
//out.write(buffer);
//out.write(buffer);
//while ((character = in.read()) != -1) {
//System.out.print((char) character);
//PrintWriter out = new PrintWriter("url.getOutputStream()");
//PrintWriter out = new PrintWriter("socket.getOutputStream()");
  private JButton jbutton;
  private JTextField jtextfield;
  public socketapplet() {
    jbutton = new JButton("Press here");
    jtextfield = new JTextField(25);
    jtextfield.addActionListener(
        new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          try {
            Socket socket = new Socket("jtextfield.getText()", 80);
            Socket url = new Socket("www.angelfire.com", 80);
            URL url1 = new URL("http://www.angelfire.com/tv2/full10/index.html");
            BufferedReader in1 = new BufferedReader(new InputStreamReader(url.
                getInputStream()));
            PrintWriter out1 = new PrintWriter(socket.getOutputStream());
            PrintWriter out2 = new PrintWriter(url.getOutputStream());
            out1.print("GET /tv2/full10/index.html\n\n");
            //out2.print("GET \n\n");
            out1.flush();
            String line;
            while ( (line = in1.readLine()) != null) {
              System.out.print(line);
            jtextfield.equals(jbutton);
          catch (Exception exc) {
            exc.printStackTrace();
//socket.close();
//}I've made some of my old code notes so I could use some of the methods for later use.
Any help would be great.
Thanks in advance,
George

I've made a JButton. When you click the jbutton the socket that is specified in the code does an inputstream and prints the results out onto the command prompt. For example when I put www.angelfire.com or www.google.com in the socket and put it to port 80 when I clicked the jbutton it printed the html source out to the cmd prompt.
Problem:
I want to make a popup or a jtextfield so the user could just enter the ip/host in then click jbutton. I tried to do that but the jtextfield never showed up on the screen. It only showed the jbutton.
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.applet.Applet.*;
public class socketapplet extends JFrame{
  public static void main(String argv[]) throws Throwable
    socketapplet m = new socketapplet();
    m.pack();
    m.show();
    public socketapplet() {
      super("socketapplet");
      JTextField jtextfield = new JTextField(25);
      getContentPane().add(jtextfield);
      JButton jbutton = new JButton("Press here");
      getContentPane().add(jbutton);
      jbutton.addActionListener(
          new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          try {
            Socket socket = new Socket("login.oscar.aol.com", 80);
  //WebBrowserPane1(socket);
            BufferedReader in1 = new BufferedReader(new InputStreamReader(socket.
                getInputStream()));
            PrintWriter out2 = new PrintWriter(socket.getOutputStream());
            out2.print("GET \n\n");
            out2.flush();
            String line;
            while ( (line = in1.readLine()) != null) {
              System.out.print(line);
          catch (Exception exc) {
            exc.printStackTrace();
  }Thank you mlk for helping me.
Thanks in advance
George

Similar Messages

  • I receive the following error message when trying to publish site changes to iweb: "Can't create the file "shapeimage_2_link_0.png." The disk may be damaged or full, or you may not have sufficient access privileges." Can anyone assist?

    I receive the following error message when trying to publish site changes to iweb:
    "Can’t create the file “shapeimage_2_link_0.png.” The disk may be damaged or full, or you may not have sufficient access privileges."
    Can anyone assist?

    Try the troubleshooting steps under "Fix iWeb" here...
    http://www.iwebformusicians.com/iWeb/iWeb-Tips.html
    ... and then republish.

  • I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    Hello,
    There is free software you can download that gives you a graphical image of what files are used on your hard drive. http://www.derlien.com/
    This may help you clean down your hard drive for more space.
    Best of luck

  • So i just got a new mac, and i am trying to sync my songs that i bought on itunes, and some of the worked, but a huge selection of them have a little exclamation mark beside it and it says it can't be downloaded, why?

    so i just got a new mac, and i am trying to sync my songs that i bought on itunes, and some of the worked, but a huge selection of them have a little exclamation mark beside it and it says it can't be downloaded, why?

    Hello Pork Chop 2,
    Congratulations on your new Mac!  It sounds like your purchased songs are not playing completely after you downloaded them.  I recommend to following steps for an issue like this:
    Symptoms
    Occasionally, if a song purchased from the iTunes Store on a Mac or PC was not downloaded completely, the song may not play back fully. The song may abruptly stop during playback, and iTunes may start playing the next song in your library or playlist.
    Resolution
    If iTunes in the Cloud is available in your country, try the following steps to resolve the issue:
    Delete the purchased song that is exhibiting the problem from your iTunes library.
    Click on the Purchased link in the iTunes Store to view your previously purchased music.
    Download your previously purchased song from this list.
    You can find the full article here:
    Songs in iTunes may not play back completely
    http://support.apple.com/kb/TS4357
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Anyone else have a little white box, top left of browser window???

    After the new big update, (that still wont allow changing the color of the arrange window...)  I notice I have a little white box top left of my browser window, in logic of course, that actually only shows up while cursor is moving.  Not a big deal, but I feel it may be associated with a new problem.  The browser window is how i usually go through my personal samples, not apple loops.  And normally, I open the folder, and play the first file via space bar, or little speaker icon.  Then I just arrow down, as fast or slow as i please, and they continue to play, without having to hit space bar or speaker icon.  No longer.  I have to hit play at every file, UNLESS I manage to skip to the next before current is done playing.  Not a huge problem, but when your riffling through a folder with 300 kick drums that are only a half a second long, it can ruffle your feathers.  I dont recall ever setting a prefference or a setting, but perhaps one exists..?  Any help would be appreciated.

    I'd send some feedback to the Logic Devs... to bring back the old functionality, if I were you....
    https://www.apple.com/feedback/logic-pro.html
    ...as they are not here....... and therefore dont tend to read posts here unfortunately...
    https://discussions.apple.com/docs/DOC-5671
    As for the spacebar problem you are having... Not happening here... unless I put the focus on the arrange window.. Click on one of the sample in the browser window and then the focus is on the browser window and the spacebar starts playing the samples... and not the project.
    Cheers..
    Nigel

  • I have a little bit problem with verify my apple ID, I don't get any message for verification aplle ID from Apple. Why? Anyone can help me

    Dear all,
    I have a little bit problem with verify my apple ID, I don't get any message for verification aplle ID from Apple. Why? Anyone can help me

    Hi Tep Virak,
    Thanks for visiting Apple Support Communities.
    You may want to log into your Apple ID first to double-check that it's the right email address and re-send the verification email using these steps:
    Sign in to My Apple ID to manage your account information.
    Click Resend under Primary Email Address.
    From:
    Apple ID: Associating and verifying email addresses with your Apple ID
    http://support.apple.com/kb/he68
    All the best,
    Jeremy

  • This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID.

    My current Apple ID, for which all of my content has been downoaded (e.g., music, apps) is associated with a work email address that I will no longer have access to in the near future.  In my Apple ID account, I noticed I had two alternate emails listed, one is my .me account and the other is my .gmail account.  I use my .gmail account, and it is the primary email I use with friends and family.  I noticed both were not verified, and when I tried to, it said they were both associated with other accounts.  I was able to log into a separate Apple ID account I must have set up at tone point with my .gmail, and I changed the email address to a new one I created.  I also deleted the gmail account from any other Apple-relted account I could think of.  I am still gettgin the same error message when I try to add it to my current Apple ID: "This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID."
    My concern is this: with FaceTime and now iMessage, it seems more important than ever that I am able to use my correct email address.  With iOS5 beta, I cannot enter either my .gmail or.me accounts under "You can be reached for messages at:" as I get an error stating: Unable to verify email because it is already in use."
    How can I remedy this issue and assign my .gmail account to my Apple ID?

    Re: Cant verify Apple ID
    created by kelly218 in iTunes Store - View the full discussion
    I just spoke with a technician at Apple.  I hsven't been able to verify because the wife has the phone.  but he said all that you need to do is:
    1) Go to Settings --> iTunes Store and login with your Apple ID and pwd
    2) Go to Settings --> iCloud and login with your Apple ID and pwd
    seems that the phone requires you to login to the store first...

  • HT4527 I can't get all my music I purchased from Itunes on my iphone to work.  When displaying them on my computer I can't play them or on my phone.  They have a little icon to the left that looks like a repeat icon.  It won't let me play them.  Please he

    I can play the music on my itunes under my purchased section but when I go to my phone when I have it connected the a lot of the songs won't play on my song or from the itunes under my phone.  They have a little icon to the left of them that looks like a repeat icon.  It won't let me delete them from there nor play them.  When on my phone only it won't play them it just brings up the clip art but will not play.  Please can anyone help me.
    Thanks,

    Thank you - I thought that might be the case BUT why doesn't the music play that I have bought from itunes - do you happen to know please.
    All that happens is it just flicks through it all and won't play any of it???
    As in I select the song and it just flicks back one screen (if I am making sense).....
    I am really stuck and cannot work out what's gone wrong that's all.
    Considering a reset of my new iphone and trying again but done that once and it's still the same.

  • How can I delete an app from launchpad, that doesn't have the little cross in the left top corner. The app isn't an App Store app. The application is also not present anymore in my application's folder in finder.

    How can I delete an app from launchpad, that doesn't have the little cross in the left top corner. The app isn't an App Store app. The application is also not present anymore in my application's folder in finder.
    I tried to use the attached command through TERMINAL :
    sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps WHERE title='Help';" && killall Dock
    sqlite3: Error: too many options: "DELETE from apps WHERE title='Help';"
    Use -help for a list of options.
    But i didn't work as I got the above error message.
    best regards
    Jeroen

    I'm in the same boat as you -- except that I manage both a school lab (volunteer job) and macs in the enterprise (pay job).  What I think we need is the Education Volume Purchasing Program
    http://www.apple.com/education/volume-purchase-program/faq.html
    Unfortunately this all seems a little rough around the edges -- for example, I have found updates for AppStore apps on the support.apple.com updates download site, but then when I install them via ARD they don't actually update the software.  (The AppStore icons still show as needing the updates, and the version info reports the old version.)  The documentation is also vague about which AppleID to use in which circumstance.  I think they just haven't finished thinking through the implications of the various procedures and policies upon the various kinds of customers.  When we deployed Mountain Lion on the school lab, we made an install usb and went around and installed it on each computer -- and it appears that you are on the honor system as far as paying for all of the licenses that you install.  We did!  But they appear to have no way to enforce it.
    So far, I have only deployed 9 Lion macs in my day job, and our "solution" to the AppStore showing updates problem has been to drag the AppStore icon off of the users' docks so they don't see them!

  • SCCM 2012 R2 reporting error: "The DefaultValue expression for the report parameter 'UserTokenSIDs' contains an error: A specified logon session does not exist. It may already have been terminated. (rsRuntimeErrorInExpression)"

    Hi,
    I have two SCCM environments under same active directory domain and one service account have been used for SCCM configurations on both the environments (QA and PRODUCTION). I am facing similar error as mentioned above while trying to fetch reports on
    PRODUCTION site, but the QA site is working fine, though same service account have been used for configuring both. While looking at the reportserverservice_<date> log on my Production DB server i see the following error
    "processing!ReportServer_0-3!2124!01/02/2015-09:09:30:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: , Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during
    report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot read the next data row for the dataset DataSet1. ---> System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'Override
    Default' to data type int."
    My DB and SCCM primary site are different and the reorting services point is installed on remote DB server. Please help me resolving the issue.
    Troubleshooting performed:
    1.Disabled the registry key 'EnableRbacReporting' from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\SRSRP to 0 and then restarted SSRS service and the reporting worked for some minutes after that the registry key reverted back to 1 automatically and
    reporting started throwing errors again.
    2. Checked with the permissions on DB whether or not 'sysadmin' role is assigned to the SCCM service account.
    3. re-registered the SQL management Provider WMI class.
    mofcomp.exe “C:\Program Files (x86)\Microsoft SQL Server\110\Shared\sqlmgmproviderxpsp2up.mof”

    Hi All,
    Finally found exact solution to the reporting error.
    Error: while launching SCCM reports (both from Console and web based) an unexpected error occured with error message as "The DefaultValue expression for the report parameter ‘UserTokenSIDs’ contains an error: A specified logon session does not exist.
    It may already have been terminated. (rsRuntimeErrorInExpression)"
    Solution: This is password replication issue for the domain account used to configure reporting services point in SCCM. If your SQL SSRS reporting services instance and databse runs with local default account whereas the reporting services point on SCCM
    primary site is configured with domain account, (As in My case) you need to perform the following in order to get rid of the error.
    Launch 'Reporting Services Configuration Manager' from the SQL SSRS box(either Local or Remote), Connect to Report Server Instance->Go to 'Execution Account' tab->Specify the 'Execution Account' as domain account and password which is used to configure
    Reporting Services Point in SCCM Primary Site, and then click apply.
    Now Lauch the report either way (Web based or from Console), the error will disappear and all your default reports will execute perfectly as before.

  • The item referred to by this shortcut cannot be accessed. You may not have the appropriate permissions

    Hi
    I originally posted this in the Windows 7 Networking forum and they advised to post it here.
    We use Windows 7 SP1 clients with Roaming Profile and Folder Redirection and they are connected to a Windows 2008 SP2 server.  We are getting issues when someone tries to open files on their redirected Desktop and they get the message "'The item
    referred to by this shortcut cannot be accessed. You may not have the appropriate permissions" if you click browse it then defaults to a different users profile.  If you click through the errors the file eventually loads.  If you open Word from
    the Start menu and then browse to the file it opens fine.  We have found that deleteting the Normal.DOTM file sometimes fixes the error, but only seems effective 50% of the time.  This doesn't happen for all users, and seems to occur in small
    groups and not all the time.  We have also had the same message come up with someone trying to open Word files an online learning resource we have created.
    There are a couple of events showing for about the time the error occured they are:
    Type Error Source Application Error Category Name 100 Event 1000
    Faulting application name: WINWORD.EXE, version: 14.0.4762.1000, time stamp: 0x4bae25b7
    Faulting module name: wwlib.dll, version: 14.0.4762.1000, time stamp: 0x4bae2623
    Exception code: 0xc0000005
    Fault offset: 0x00034b81
    Faulting process id: 0x1734
    Faulting application start time: 0x01d0234ef75c42aa
    Faulting application path: C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE
    Faulting module path: C:\Program Files (x86)\Microsoft Office\Office14\wwlib.dll
    Report Id: 6f74438b-8f42-11e4-9e45-00c2c6506cb5
    Type information Source Office Software Protection Platform Service Category Name 0 Event 1003The Software Protection service has completed licensing status check.
    Application Id=59a52881-a989-479d-af46-f275c6370663
    Licensing Status=
    1: 1f76e346-e0be-49bc-9954-70ec53a4fcfe, 1, 1 [(0 [0x00000000, 1, 0], [(?)(?)( 1 0x00000000 30 0 msft:rm/algorithm/hwid/4.0 0x00000000 0)(?)(?)(?)])(1 )(2 )]
    2: 9da2a678-fb6b-4e67-ab84-60dd6a9c819a, 1, 0 [(0 [0xC004F014, 0, 0], [(?)(?)(?)(?)(?)(?)])(1 )(2 )]
    3: dd457678-5c3e-48e4-bc67-a89b7a3e3b44, 1, 0 [(0 [0xC004F014, 0, 0], [(?)(?)(?)(?)(?)(?)])(1 )(2 )]
    The software protection message we get in clusters of about 6 or more multiple times through the day

    Hi
    An update.  We have approx 400 people with roaming profile/folder redirection on Windows 7/2008 and this only seems to have occurred to about 15 people, and then seems to clear up for a period and then happens again.  We also have a similar number
    of people with roaming profile/folder redirection on Windows 7/2003 system and we haven't had a report of this issue happening on this setup.
    So far we haven't been able to replicate the issue using a test account, so are struggling to find out what is causing it and why it is so random.
    Regrds
    Dave

  • I have just purchase Apple TV and uploaded my itunes from my pc to icloud, this has been shared to my ipad and i now have a little cloud with a red arrow next to all my tunes, so all would seem well, but on the apple tv nothing in music ? is it me?

    I have just purchased Apple TV and an ipad, i have uploaded my itunes to icloud from my pc and activated sharing, i now have all my tunes on the ipad and pc and all have a little cloud with a red arrow next to them so all seems well, but when i go on Apple TV, and i'm all signed in and all boxes checked, i click on music, my music, and all files are empty, should i not see my itunes and be able to play them from my apple TV, or have i misunderstood what the cloud is for.?
    Any answers please. Apple TV 3rd Gen,  Ipad Air.

    Welcome to the Apple Community.
    You can't play music from the computer if there is none there. If you are using iTunes Match you should now be able to download and play all your music on the Apple TV from the music feature on the main page.

  • How do I move a movie I have synced from iTunes into the "Movies" tab of the Video App? I need to access a slideshow I made in IMovies and may not have WiFi. I did it once, but can't figure out how to do it again! The file is an m4v. Thank you!

    How do I move a movie I have synced from iTunes into the "Movies" tab of the Video App? I need to access a slideshow I made in IMovies and may not have WiFi. I did it once, but can't figure out how to do it again! The file is an m4v. Thank you!

    Im just guessing but it seems like you would have to get your movie into the correct folder on a computer then use iTunes to sync it to your iPad. If you've synced to a computer and have movies then on your computer should be a folder with the movie in it. You could export your iMovie to something like Dropbox then download from Dropbox to the folder you think it needs to be in the sync your iPad again. Again this is just a guess. Others may have a better answer.

  • My entire music library (purchased and my own) can't be put onto my itouch.  All these files have a little explanation point next to it.  When I click on it to play it it says file could not be found.  How do I get my music back?

    I've downloaded a normal software upgrade and now my computer doesn't recognize that my music files are mine....I guess.  Itunes library has tons of songs that I've either downloaded from disc or purchased from itunes.  Now, they all have this little explanation point next to the file name.  Can't put them on my itouch and can't play them on the computer.
    Tried to ask apple to help...they want $29.  I don't understand...I was simply upgrading my itouch with their software updates and now this.  Had the same problem with my apps.  Had to redownload all of them individually.  Didn't have to pay for them again.  They, too, had the little explanation mark next to them.
    Help me.
    I'm music-less.
    Kathy

    Ok, I had a glitch, forced to restart, and lost my train of thought.
    Reinstalling iTunes should fix the major issue that might have gone wrong, perhaps your explaination points will disappear and everything will be peachy again.
    But if they don't, you can open the XML file in iTunes Folder using a Text edit program to see what the common pathname is to the iTunes Music folder or where your content is located.
    If you moved the itunes folder, it needs to go back.
    I can't  download iTunes to my Vista virtual machine to test it out right now because iTunes is down, so I can't verify the pathname, perhaps your issue and the iTunes being down are related somehow?
    You don't want to import all your music again, but it's a option, but you lose all your playlists, that's what I'm trying to recover.
    If oyu don't have a whole lot of playlists, then simply select all the explaimation point music and delete, select File from the menu and import your itunes folder again.

  • I have used migration assistant but new profile is created, how do i merge into one

    I have recently purchased Mac book and have used migration assistant to transfer files from my old windows PC.
    Due to some issues when using migration tool i had to transfer in segments, each time i did this a new user was created.
    I have asked for  some help and was advised that users cannot be merged however the files can be shared via dropbox.
    I have received instructions as to how to do this but am stuck as once I get to the point of dropbox, I do not know what step to take next to add files into dropbox?.
    Below are instructions
    Pick a User Account your going to keep, make sure it's a Admin account and if need to, log into another Admin account and make it so in System Preferences > accounts.
    One logs out of their current account by using the Apple menu > Log out.
    Next while in one of the accounts your later planing on removing, go to the Finder > Go > Computer and window opens.
    Open  the MacintoshHD partition, then the Users folder and the User Account  you plan to keep, then the Public folder and then locate the DropBox  folder for that User. Any files placed in there will change permissions  and be accessible to that user when you log into it.

    The Dropbox folder is a subfolder of the home folder, which has the same name as the user account. It's under the Users folder at the top level of the startup volume ("Macintosh HD," unless you gave it a different name.)

Maybe you are looking for