Results 1 to 14 of 14
Like Tree1Likes
  • 1 Post By quad64bit

Thread: Convert graphical JApplet to facebook iFrame app

  1. #1
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Question Convert graphical JApplet to facebook iFrame app

    how can i convert a graphical JApplet to a facebook iFrame app (with amazon AWS hosting)?

    i've researched this for a few days now + i'm no closer to finding a solution.
    i did originally intend to use google GAE, but amazon is less restrictive.

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    I'm not sure you can. I'm not sure facebook will allow an Applet to make it's way through the iframe to the user. Does it have to be an Applet?

    Have you gotten a simple html page to show in the iframe?

  3. #3
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    It doesn't have to be an applet.
    it is an applet (JApplet) at the moment, but I'm prepared to convert it into whatever format it takes to make it work.

    I'm planning on using amazon AWS for hosting, but I have no idea how just yet + I'd appreciate any help from anyone who has experience with that.

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    Amazon hosting is nice - I use it. You can do a lot of things with it, including simple cloud storage.

    I use the EC2 service which works like this:
    Basically, you get a virtual server and can put any OS you want on it. When you create your server, you can pick the size of the instance you want - there is a free tier for the first year if you make a mico-instance (do this!). Then you can either spend time building your own amazon OS image, or instead, pick a premade one from the list. The list is huge (thousands), but I recommend this one: AMI: ami-cf33fea6. Thats a 64 bit ubuntu 10.04 LTS build. Pretty easy to use, comes pre-configured to work nicely with the cloud.

    You will then need to set it up to run your app. If you end up going with the applet route, then all you need is apache. If you go with an enterprise app instead (this might be a better way to do what you want to do, whatever that is) then you need an application server like tomcat.

    Which way you do it depends on if you need control over the server, if you need a database, and a dozen other little things. If you can make the same app without using an applet, it'd probably be preferable, since applets are really a 90's thing and everyone is trying to forget them!

    Good Luck!

  5. #5
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    thanks for the help.

    ok so i created a t1.micro instance + chose a 64 bit ubuntu 12.(something) LTS build image
    i've been reading the documentation + trying to follow your reply, but i can't see how to, first... set it up to run my app, or second, how to install apache

    the JApplet is just a small self contained game. no database needed, no login needed.
    in the finished facebook app, i want to post a public message. i.e. username played gamename etc, but that is looking much further ahead than where i am now.

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    Ok, so with an applet, all it needs it to be embedded in an html page. Do that and test it locally in your browser. If that looks good, then apache setup on ubuntu is pretty simple. Log into your box with ssh and then:

    Update your apt-get database with:
    Java Code:
    sudo apt-get update
    Then install apache with:
    Java Code:
    sudo apt-get install apache2
    That should install everything you need and launch apache too. The default location to put your web files is in /var/www. This often is a root folder, so you'll need to sudo or switch to root to move files in and out of there.

    To test if apache is working, you need to do 2 things:
    1. In the EC2 dashboard, click the Security Groups nav link on the right, and then click on the default group on the right. In the bottom right pane, click the "Inbound" tab. You'll need to open port 80 so you can reach your server via browser. Make a new TCP rule for port range 80, leave the source field on the default, and click "Add Rule" and then "Apply Rule Change".

    2. Test apache by going to your browser and entering in the server address (the same one you ssh with, ends with something like compute-1.amazonaws.com). The default apache page should appear (this is the index.html file in /var/www).

    If that works, you're ready to put your stuff online - tar or zip your files and upload them to your server with SCP. Then SSH into the server, unzip your stuff, and use sudo to move it into the /var/www folder. You can replace any files already there, you don't need them. If you main file is called index.html (the one with your applet on it [also, don't forget to include your applet with your html]) then going to your server in the browser (like in step 2) should load up your applet the same way it did locally.

    BTW, a word of caution. The EC2 micro instance is not completely free. You get a certain number of hours of compute time, a certain number of gigs of storage, and a certain number of gigs of bandwidth. By default, with only 1 cpu, the free tier will cover the cpu expense. Also, an ubuntu install and some apps wont come anywhere near the storage cap. But, if for some reason your app blows up and 100,000,000 people start viewing it on facebook, you will be charged for any bandwidth over your cap. It's not super expensive, something like 10 cents a gig, but it can add up fast in the right circumstances. The same is true if you add a second CPU to your server - that will eat your processor allocation twice as fast and will start charging you a few cents an hour for the second half of the month.

    I've used ec2 without issue for almost 2 years, but be mindful of unexpected overages. You can safely shut down your machine any time without loosing data, but don't terminate it (that will destroy it).
    .paul. likes this.

  7. #7
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    thanks for the help, so far.

    i've followed your instructions up to the first part of step 2 + tested it + it works.
    i've also embedded my applet in a blank html page + tested it locally.

    i'm having difficulty scp 'ing my files. i've googled it but couldn't find an answer.
    i also googled moving files between folders on my server, but i can't find an answer to that either.

    2 more questions:

    1/ when i do have my files + html page uploaded, what will the url be?
    2/ in my app setup in facebook, i have to provide a canvas url + a secure canvas url. what will they be?

  8. #8
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    Do you use a unix system or windows? Windows doesn't have scp, you'd need to use something like putty or a sftp app. sftp and scp are more or less the same thing. You generally cannot upload folders (unless using a gui client) so you would need to compress any folders you have into a single file.

    1/ when i do have my files + html page uploaded, what will the url be?
    It will be the same as the address of your server followed by the name of your html file. If you html file is index.html, then you don't need to type that part, it is implied.

    2/ in my app setup in facebook, i have to provide a canvas url + a secure canvas url. what will they be?
    Haven't done a lot with this personally. The basic canvas URL will be the same as above. The secure canvas url is probably referring to https/ssl? That would mean a secure version of the same page, usually running on port 443 instead of 80. Thats more setup - are you 100% sure you need the secure one too?

  9. #9
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    i use windows. i've just finally managed to upload the files to the /var/www folder + i found the url.
    the applet doesn't load, i'm currently in the process of googling it. would it make a difference that i used the netbeans version of the applet (not a webproject)?

    as far as i know facebook requires both urls, but i can probably find an answer to that later

  10. #10
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    actually, i tried again. lagging. it now works. thanks for the help...

  11. #11
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    i spoke too soon.
    it does work as expected in ie if another ie tab has aws management console open.
    if i open ie + navigate to my ec2 html page the page loads but the applet doesn't. it seems as if apache is only running when i open my aws management console?

    do you have any idea what might be causing this?

  12. #12
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    First off, IE is a turd. I have no idea why you would even try to use IE for anything other than windows update.

    Second, no, assuming you're not shutting down the instance before you leave the aws console, there is no way having that open in a tab has anything to do with an applet loading or not. I suggest you try it in chrome.

  13. #13
    .paul. is offline Member
    Join Date
    Jun 2012
    Posts
    73
    Blog Entries
    1
    Rep Power
    0

    Default Re: Convert graphical JApplet to facebook iFrame app

    Quote Originally Posted by quad64bit View Post
    First off, IE is a turd. I have no idea why you would even try to use IE for anything other than windows update.

    Second, no, assuming you're not shutting down the instance before you leave the aws console, there is no way having that open in a tab has anything to do with an applet loading or not. I suggest you try it in chrome.
    yeah chrome works. since my last post i discovered several other sites that my applet works properly when sharing ie with, 1 of them being facebook, so i suppose that solves the problem but i'd prefer a better solution.
    i was wondering if those other sites have something in their html that preloads java so to speak?

  14. #14
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Convert graphical JApplet to facebook iFrame app

    something in their html that preloads java so to speak?
    Not sure - but something like an applet is seen as just another embedded content item in an HTML page to a browser I believe. That means that http 1.1 is going to load it along with everything else on the page, probably all at once.

    There could be other reasons why IE doesn't work - but IE doesn't work with a LOT of things. Maybe your security settings are too strict?

Similar Threads

  1. convert JApplet to GAE java facebook app
    By .paul. in forum Java Gaming
    Replies: 0
    Last Post: 11-08-2012, 01:29 PM
  2. convert JFrame to JApplet
    By hrayr in forum AWT / Swing
    Replies: 1
    Last Post: 05-06-2012, 03:00 PM
  3. IFRAME in jsp
    By Waqas in forum Advanced Java
    Replies: 0
    Last Post: 08-07-2009, 11:48 AM
  4. JFrame to JApplet or JApplet to JApplet
    By ramesh.8189 in forum AWT / Swing
    Replies: 13
    Last Post: 02-08-2009, 06:14 AM
  5. Send keystrokes to iframe
    By nloding in forum New To Java
    Replies: 3
    Last Post: 08-29-2008, 05:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •