Results 1 to 4 of 4
  1. #1
    tecno40 is offline Member
    Join Date
    Nov 2010
    Posts
    13
    Rep Power
    0

    Default exec not working in browser

    Ok so I created a code in java to open another program on my computer. When i ran the code inside Netbeans the code open the other program worked fine, but when i exported it and ran the code in my browser it did not open the program.

    Also i added another few lines of code to draw a rectangle and some text that required the app to be signed (i currently have it set to self-sign) and that worked fine so i know the compiler and signature are working correctly.

    I've spent a few hours searching for why the code won't work in browsers, but found no solution so I'm hoping someone here knows what the problem is.






    Java Code:
        
    import java.awt.*;
    import java.applet.*;
    import java.io.*;
    
    
    // Tells the applet you will be using the MouseMotionListenermethods.
    
    public class MouseMotionExample extends Applet implements MouseMotionListener
    {
    public static void main(String args[])
        {
            try
            {
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec("C:\\Users\\Trent\\Documents\\eRUN.exe");
            } catch (Throwable t)
              {
                t.printStackTrace();
              }
        }}

  2. #2
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    What does the browser java console say on the error?

  3. #3
    tecno40 is offline Member
    Join Date
    Nov 2010
    Posts
    13
    Rep Power
    0

    Default

    This is what the java console report says. Other than that i get not error messages.

    Java Code:
      <information>
        <title>Exe</title>
        <vendor>Trent</vendor>
        <homepage href=""/>
        <description>Exe</description>
        <description kind="short">Exe</description>
        <offline-allowed/>
      </information>
      <security>
        <all-permissions/>
      </security>
      <resources>
        <j2se java-vm-args="-Djava.security.policy=applet.policy" version="1.5+"/>
        <jar eager="true" href="Exe.jar" main="true"/>
      </resources>
      <applet-desc height="300" main-class="exe.MouseMotionExample" name="Exe" width="300"/>
    </jnlp>jnlp
    temp: returning LaunchDesc from XMLFormat.parse():
    
    <jnlp spec="1.0+" codebase="file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/" href="file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp">
      <information>
        <title>Exe</title>
        <vendor>Trent</vendor>
        <homepage href="null"/>
        <description>Exe</description>
        <description kind="short">Exe</description>
        <offline-allowed/>
      </information>
      <security>
        <all-permissions/>
      </security>
      <update check="timeout" policy="always"/>
      <resources>
        <java java-vm-args="-Djava.security.policy=applet.policy" version="1.5+"/>
        <jar href="file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar" download="eager" main="true"/>
      </resources>
      <applet-desc name="Exe" main-class="exe.MouseMotionExample" documentbase="file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/" width="300" height="300"/>
    </jnlp>
    network: No Custom Progress jar
    network: LaunchDownload: concurrent downloads from LD: 4
    network: Total size to download: -1
    network: CleanupThread used 3 us
    network: CleanupThread used 3 us
    network: CleanupThread used 2 us
    network: CleanupThread used 4 us
    network: CleanupThread used 2 us
    network: CleanupThread used 2 us
    network: CleanupThread used 2 us
    cache: Skip blacklist check as cached value is ok.
    network: Cache entry found [url: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar, version: null] prevalidated=false/0
    network: ResponseCode for file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar : 200
    network: Encoding for file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar : null
    cache: Replacing MemoryCache entry (cnt=0) for file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jarwas=com.sun.deploy.cache.CacheEntry (962420767) now=com.sun.deploy.cache.CacheEntry (962420767)
    network: Downloaded file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar: file:/C:/Users/Trent/AppData/LocalLow/Sun/Java/Deployment/cache/6.0/45/5a01c6ad-2eee3680
    network: Download Progress: jarsDone: 1
    network: Created version ID: 1.5+
    network: Created version ID: 1.6
    network: Created version ID: 1.6.0.18
    network: Created version ID: 1.6
    basic: LaunchDesc location: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp
    network: Created version ID: 1.0+
    network: Created version ID: 6.0
    security: Validating signatures for file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp
    security: TustedSet null
    security: Empty trusted set for [file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp]
    security: Round 1 (0 out of 1):file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar
    security: Entry [file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar] is not prevalidated. Revert to full validation of this JAR.
    security: Round 2 (0 out of 1):file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar
    security: Validating cached jar url=file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar ffile=C:\Users\Trent\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\45\5a01c6ad-2eee3680 com.sun.deploy.cache.CachedJarFile@219fdbcb
    security: Istrusted: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp false
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Loading certificates from Internet Explorer TrustedPublisher certificate store
    security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
    security: Validate the certificate chain using CertPath API
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: No timestamping info available
    security: Found jurisdiction list file
    security: No need to checking trusted extension for this certificate
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    security: Checking if certificate is in Deployment session certificate store
    security: Mark trusted: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp
    basic: LD - All JAR files signed: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/launch.jnlp
    basic: passing security checks; secureArgs:false, allSigned:false
    basic: continuing launch in this VM
    basic: JNLP2ClassLoader.getPermissions() ..
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Loading certificates from Internet Explorer TrustedPublisher certificate store
    security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
    security: Validate the certificate chain using CertPath API
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: No timestamping info available
    security: Found jurisdiction list file
    security: No need to checking trusted extension for this certificate
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    security: Checking if certificate is in Deployment session certificate store
    security: JAVAWS AppPolicy Permission requested for: file:/C:/Users/Trent/Documents/NetBeansProjects/Exe/dist/Exe.jar
    basic: JNLP2ClassLoader.getPermissions() X
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt -1 us, pluginInit dt 21252643672 us, TotalTime: 21252643671 us
    basic: Applet initialized
    basic: Removed progress listener: null
    basic: Applet made visible
    basic: Starting applet
    basic: completed perf rollup
    basic: Applet started
    basic: Told clients applet is started
    Last edited by tecno40; 11-11-2010 at 04:30 AM.

  4. #4
    tecno40 is offline Member
    Join Date
    Nov 2010
    Posts
    13
    Rep Power
    0

    Default

    Ok so after further testing i learned if i export it as an application instead of an applet the code works fine. I'm thinking it's an applet security problem blocking the exec code or opening the exe file on the machine.

    How would i write this code to allow me to run the exe from the applet?

Similar Threads

  1. browser compatibility..CSS code is working in Mozilla but not in IE
    By satyaprsp in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 09-07-2010, 11:35 PM
  2. Replies: 1
    Last Post: 08-19-2010, 12:47 PM
  3. Applet working in Eclipse but not in browser
    By leeloo in forum Java Applets
    Replies: 7
    Last Post: 07-05-2010, 01:24 AM
  4. Applet not working in browser
    By gkr1989 in forum Java Applets
    Replies: 3
    Last Post: 07-03-2009, 09:43 AM
  5. Replies: 8
    Last Post: 05-28-2008, 07:00 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
  •