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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.