0

I have a very simple application. Here is the entire source code:

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
public class AppTest {
    public static void main(String[] args) {
        Date myDate = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String myDateString = sdf.format(myDate);
        FileWriter fstream = null;
        BufferedWriter out = null;
        try{
            fstream = new FileWriter("AppTest.log",true);
            out = new BufferedWriter(fstream);
            out.append(myDateString + " AppTest has run\n");
            out.close();
            fstream.close();
        }catch (Exception e){}
    }
}

It will run on operating systems other than Mac OS X. It will run on Mac OS X if I force the use of Java 6. This can be done from the command line:

/System/Library/Java/Support/Deploy.bundle/Contents/MacOS/javaws -XstartOnFirstThread http://forexhitandrun.com/app_dev/apptest.jnlp

In this case, it writes one line to the log file so I know it has run.

But if I run it as a webstart app from the browser like so:

http://forexhitandrun.com/app_dev/apptest.jnlp

Nothing gets written to the log file. This method uses the most recent update of Java 7 from Oracle.

But before we jump to the conclusion that it is my Java installation that is at fault, I can launch a different app from the browser (therefore Java 7) and it does work:

http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/JavaTest/

Has anyone experienced something similar, or does anyone have any clues about what might be wrong?

Peter
  • 854
  • 10
  • 19
  • Probably caused by http://stackoverflow.com/questions/21404830/securityexception-during-executing-jnlp-file-missing-required-permissions-manif – Anya Shenanigans Apr 25 '14 at 14:36
  • Thanks, Petesh. I tried this, but it did not affect anything. The only output in the trace log is: Log started: Fri, 25 Apr 2014 15:52:37 +0100 Java Web Start 10.55.2.13 Using JRE version 1.7.0_55-b13 Java HotSpot(TM) 64-Bit Server VM – Peter Apr 25 '14 at 14:54

1 Answers1

0

Petesh's remark made me think about the jnlp file, because all-permissions is defined there under the security tag. I am not sure what it is in the jnlp file that java doesn't like, but I just copied some of the resource info from the app that did work and presto it works now.

Here is the resource part of my jnlp file now:

<resources> 
    <j2se version="1.6+" spec="1.0+" initial-heap-size="64m" max-heap-size="128m" href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="apptest.jar"/>
</resources> 

Thanks! Now I can debug the real app.

Peter
  • 854
  • 10
  • 19