Page 1 of 2 12 LastLast
Results 1 to 20 of 21
Like Tree1Likes

Thread: HTML page with applet

  1. #1
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default HTML page with applet

    Hi

    Wonder if someone would be able to get me started as I am pulling my hair out (what I have left).

    We have a login html page with an embedded javascript applet, which works great for Windows based machines. Doesn't work for MACs and we need to do something for this.

    What I want to have is one login.html page which will display one of two applets embedded within - one if navigator.platform is Win32/Win64, one of MAC - because of what we are doing, this is the only choice, so not interested in ipad/iphone/any other device.

    The end solution needs to launch remote desktop application, or equivalent - this bit is my problem. The only way we know of to do this is for the java applet to download a launcher application from our web servers and run it. As I said, this works for Windows.

    What I am asking for help with is for the MAC side. The html page to display a java applet which has a button which downloads a file from the webserver and run it. A simple application which just displays a dialog box saying anything ('work it out yourself' is even acceptable).

    We do have development knowledge, but we have never used a MAC, Objective C or xCode. Heck, it took me 10 minutes and google search to find the flippin power button :) The MAC we have is version 10.7.5, but hoping that whatever code we write will work on any of the later OS versions.

    Any help/guidance/suggestions/starter code would be gratefully appreciated.

    Many thanks.

    James

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    Just so I understand: you have a Java applet that works on Microsoft and Linux, but not on Mac?

    What error are you getting on Mac?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    Yes, it works on MS Windows. Not bothered about Linux. There isn't an error as such on the MAC.

    What we are currently doing on Windows is the login page, once validated, calls a javascript to download a launcher application to the client which fires off a Windows RDP connection to one of our servers to run a Windows application. This is fine.

    The problem is that due to no 'standard' RDP application for a MAC, we are going to have to use an external application. So for MAC users we need to download a different launcher application to the client to fire off this third party client software to connect to our server to run the application.

    We don't want Windows users to go to one page and MAC users to go to a different page, we want one page which should work out what it should do.

    Hope this makes sense - it does to me but I know what we want to achieve.

    James

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,018
    Rep Power
    6

    Default Re: HTML page with applet

    Sooo... in the applet itself you'd need to check the OS and go either left or right.

    How do I programmatically determine operating system in Java? - Stack Overflow
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    Is this a Java question, or a javascript question? They are two very different things.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    That has helped, thanks. Was obviously searching for the wrong thing to work out what the OS is within Java. Now have a JAVA file which does something on both Windows & MAC.

    Now for the MAC. I have created myself a test 'cocoa application'. Doesn't do anything apart of display a blank form. What do I need to put onto the server regarding this application so that I can get the java application to download and run? I have found what I think is the compiled project - buried in Users\mac\library\developer\xcode\deriveddata\test obj\build\products\debug\testobj. This looks like a file on the MAC, if I copy this file onto my server it is a folder of a dozen or so files.

    KevinWorkman, that is a good question, but I think I have moved forward thank to gimbal2's posts. See previous paragraph on my next issue.

    Many thanks.

    James

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    You've used the term applet a few times, but I'm not sure you're using it correctly. Is there an actual *Java applet* that's running on the client's computer, or is it all javascript and html?

    Are you asking about client-side Java, server-side Java, or not Java at all?
    gimbal2 likes this.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,018
    Rep Power
    6

    Default Re: HTML page with applet

    I'm utterly lost too. At this point no code = no help.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    There is a java applet, so I have been informed by the chap who wrote the Windows side of it together. The code in the HTML file which loads this is:

    <div style="border: 1px solid #CCC; padding: 10px; border-radius: 6px; width: 600px;">
    <div id="table_noborders">
    <form action="contactsendmail.php" method="post" name="drop_list" >
    <object type="application/x-java-applet" name="PV247" width="600" height="180">
    <param name="codebase" value="." />
    <param name="code" value="com.LoginApplet.class" />
    <param name="archive" value="pv247.jar" />
    <param name="internal" value="dbname">
    <param name="session" value="ip.address">
    <param name="configname" value="DOWNLOAD_SERVER">
    <param name="htmlAdr" value="http://www.websitename.com">
    </object>
    </form>
    </div>
    </div>

    James

  10. #10
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    Sorry gimbal, didn't see you response when i posted the last which shows the applet.

    This applet is just a username/password app. When you click login button it currently downloads a couple of files to the client then runs the executable (Windows only).

    I have created a simple application on the MAC, all it does it display a dialog box. I am lost as to what I need to put on the web server for a MAC machine to download and then launch.

    Many thanks.

    James

  11. #11
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,018
    Rep Power
    6

    Default Re: HTML page with applet

    I really don't understand any of this. You contradict yourself in so many ways.

    You claim: The applet is "just" a username/password app.
    You then further say: "When you click login button it currently downloads a couple of files to the client then runs the executable"

    So no it is NOT 'just' a username/password app. It is the applet which is offering the files. Your own words. If this is wrong then you are making a big effort to give the wrong information.

    Your problem: on a mac you need to download different files because of course the Windows installation stuff doesn't work.


    Since it is the applet offering the files, it is the applet that needs to distinguish the OS it is running on and offer the set of files that matches the platform. Yet here you are trying to somehow find a solution by "putting something on the webserver". Why!?

    Don't tell me it is because you fear to ask this "person who wrote the windows side" for help and you are trying to find a workaround so you don't have to deal with him. The applet needs to be adjusted to cope with these new requirements, its as simple as that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  12. #12
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    Sorry for all the confusion. I was trying to get the MAC routine to do the same as the Windows routine. Realized that I don't need to do that at all.

    As for avoiding the guy who wrote the windows routine, not so. He know as much about MACs as I do - nothing.

    Taking what I now think is the correct route. What we need to do is launch the application Blaze client (RDP Accelerator for MAC). Blaze is installed with the following information:

    Where: /Applications/Ericom Blaze
    Name: blaze.app

    Code I am using in my procedure:

    Runtime rt = Runtime.getRuntime();
    String[] sPath = {"/Applications/Ericom Blaze/blaze.app"};
    try {
    rt.exec(sPath);
    } catch (IOException e) {
    LOGGER.severe("Error running MAC Application. " + e.getMessage());
    throw new RDPException();
    }

    This throws Error 13: Permission denied. With the following difference (as found on some searches), I get the error 'Cannot run program "open": error=1, Operation not permitted
    String[] sPath = {"open", "/Applications/Ericom Blaze/blaze.app"};

    Think I am moving forward. At least I can get my website to try and launch the app, but missing some security options.

    Many thanks.

    James

  13. #13
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    Where are you running that code? In the applet? On the server for some reason?
    Last edited by KevinWorkman; 07-09-2014 at 02:49 PM.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  14. #14
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    The code is in my java applet embedded in a web page.


    James

  15. #15
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    I guess I don't know anything about macs. Does that code work if you run it from a jar or class directly instead of from an applet?

    Can you write a smaller program that just runs a simple program installed on all macs? Can you run that on a mac (not from an applet) and see what happens?

    Are you sure that file exists on the client's computer? Do you have read/execute permission for it?

    What permissions does the applet have?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  16. #16
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    The application (Blaze) is installed on the MAC I am testing it on, in the folder specified earlier.

    According to the permissions, the following is set:
    imac (Me) : Read & Write
    admin: Read & Write
    everyone: Read only

    I have tried some other applications which are on the MAC and I get the same problem - error 13, permission denied.

    I will try and put a new app together to run locally.

    James

  17. #17
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: HTML page with applet

    An Applet has no permission (by default) to execute stuff on the client machine.
    That would, after all, be something of a security hole.

    It would need to be signed with all the correct privileges in order to be able to do that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  18. #18
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    Thanks Tolls. We have signed the applet, not sure what for, would need to check.

    I have thrown together a runnable jar file, code below:

    import java.io.IOException;

    public class Login {
    private static String _sOpSystem = System.getProperty("os.name").toLowerCase();

    public static void main(String[] args) {
    if (_sOpSystem.startsWith("win")){
    try {
    // create a new array of 2 strings
    String[] cmdArray = new String[2];
    // first argument is the program we want to open
    cmdArray[0] = "notepad.exe";
    // second argument is a txt file we want to open with notepad
    cmdArray[1] = "example.txt";
    // print a message
    System.out.println("Executing notepad.exe and opening example.txt");
    // create a process and execute cmdArray and currect environment
    Process process = Runtime.getRuntime().exec(cmdArray,null);
    // print another message
    System.out.println("example.txt should now open.");
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    else {
    try {
    StartMACApp();
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    }

    private static void StartMACApp() throws Exception {
    Runtime rt = Runtime.getRuntime();
    String[] sPath = {"open", "/Applications/Ericom Blaze/blaze.app"};//, null, "/Applications/Ericom Blaze/"};
    try {
    System.out.println("testing");
    Process pr = rt.exec(sPath);
    } catch (IOException e) {
    e.printStackTrace();
    throw new Exception();
    }
    }
    }

    This works on both Windows (launches notepad) and MAC (launches Blaze).

    Copy the content of the StartMACApp method into my applet and the error is:

    Cannot run program "open": error=1, Operation not permitted

    Guess this is due to the comment made by Tolls. Do we need to sign the applet as anything specific to run on MAC?

    James

  19. #19
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: HTML page with applet

    I'm surprised that this works on one but not the other. Are you using the same version of Java on both machines? Either way, you would need to sign the jar and specify the permissions.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  20. #20
    JamesAlcroft is offline Member
    Join Date
    Jul 2014
    Posts
    10
    Rep Power
    0

    Default Re: HTML page with applet

    Not sure if this helps, but below is the signing routine we have for the JAR file.

    jarsigner -storetype pkcs12 -keystore PV247_UK_certificate.pfx pv247.jar "le-dcce212e-9ac4-42a8-9a72-a4cda9005594"

    jarsigner -verify -verbose -certs pv247.jar


    Could the problem be that we don't have the correct type of certificate?

    James

Page 1 of 2 12 LastLast

Similar Threads

  1. Add 3D applet to html page
    By Dennis in forum Advanced Java
    Replies: 24
    Last Post: 08-01-2010, 01:07 PM
  2. Replies: 0
    Last Post: 03-10-2008, 02:36 PM
  3. How to view applet from html page.
    By jwzumwalt in forum Java Applets
    Replies: 2
    Last Post: 11-24-2007, 04:21 AM
  4. HTML page
    By bbq in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 03:46 AM
  5. Create a Applet in the page HTML
    By Daniel in forum Java Applets
    Replies: 2
    Last Post: 07-04-2007, 07:52 AM

Posting Permissions

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