I can't open or save file with Java Web Start

Hi,
i can't open or save file with Java Web Start:
import java.io.*;
import java.util.*;
public class MetaDataFileCreator {
public String fileNameSpace = null;
public String fileName = null;
protected Properties file = null;
public MetaDataFileCreator(String fileNameSpace, String fileName) {
this.fileNameSpace = fileNameSpace;
this.fileName = fileName;
public void createMetaDataFile() {
try {
System.out.println("file METADATA");
ClassLoader cl = this.getClass().getClassLoader();
String nameFileMetaData = fileNameSpace + fileName + ".txt";
FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
file = new Properties();
file.setProperty("aaaaa", "aaaa");
file.store(fileOS, "");
fileOS.close();
} catch (Exception e) {
System.out.println("Error writing metadata-file: " + e);
System.exit(1);
e.printStackTrace();
I have try also to open a file like this:
ClassLoader cl = this.getClass().getClassLoader();
file.load(cl.getResourceAsStream(nameFile));
also like this:
try {
fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
} catch (UnavailableServiceException e) {
fss = null;
fos = null;
System.out.println("Error with JNLP");
System.exit(1);
if (fss != null && fos != null) {
try {
// get a FileContents object to work with from the
// FileOpenService
FileContents fc = fos.openFileDialog(null, null);
//FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
// get the OutputStream and write the file back out
if (fc.canWrite()) {
// don't append
os = fc.getOutputStream(false);
} catch (Exception e) {
e.printStackTrace();
also like this:
File f = new File((System.getProperty("user.home")+"x.txt").toString());
FileOutputStream fileX = new FileOutputStream(f);
OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
OutputX.println(....
but it doesn't work with Java Web Start.
Can someone help me?
How can I open or save file?
thank you.
Sebastiano

Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

Similar Messages

  • How import policy file with Java Web Start

    hi everybody,
    I wrote an application launched by Java Web Start.
    This application encrypt data on the client side and POST them to the server.
    To encrypt I use JCE packages including sunjce_provider.jar, jce1_2_1.jar and
    local_policy.jar and US_export_policy.jar.
    local_policy.jar and US_export_policy.jar are not packages, each of them contains
    a policy file.
    When I test encryption on local no problem, but when I test with Java Web Start
    I've got this exception :
    java.lang.ExceptionInInitializerError:
    java.lang.SecurityException: Cannot set up certs for trusted CAs
    It's because the application launched by Java Web Start doesn't find local_policy.jar
    and US_export_policy.jar.
    There's a problem in my JNLP file :
    <jnlp spec="1.0+" href="http://myserver/sources/test.jnlp" codebase="http://myserver/sources">
         <information>
              <title>Java Web Start TEST</title>
              <vendor>NLE Intech</vendor>
              <description>cryptage then upload</description>
         </information>
         <security>
              <all-permissions/>
         </security>
         <resources>
              <j2se version="1.3" />
              <jar href="sunjce_provider.jar" />
              <jar href="jce1_2_1.jar" />
              <jar href="local_policy.jar" />
              <jar href="US_export_policy.jar" />
         </resources>
         <application-desc main-class="HelloWorldSwing" >
              <argument>c:\myfiletoencrypt</argument>
         </application-desc>
    </jnlp>
    thank you for your answer

    Hi Nicolas,
    If you migrate to JDK1.4 and use the signed Bouncy JAR, you could resolve the problem,
    if you don't want to use unlimited cryptography.
    See my posting on your other question.
    Agnes
    PS. There is a mistake in my other reply, the "local_policy.jar" and the other files must have
    to go into JRE/LIB/SECURITY directory

  • I can't open a PDF file with password with my iphone app

    I can't open a PDF file with password with my iphone app, the app send me an error, but the password is correct. This only happend in the new version of iphone. In the latest version I didn't have this problems.

    Can you please share the file with us at [email protected]? Also, can you please confirm that you are viewing the PDF in the Adobe Reader app rather than an app like dropbox, Mail or Safari?

  • HT204382 I can't open a .wmv file with quicktime player.  Shouldn't I be able to?

    I can't open a .wmv file with quicktime player.  Shouldn't I be able to?

    No. To do so you need to install Flip4Mac WMV Player 2.4.4.2.

  • I can't open D7200 NEF file with Photoshop CS6. I checked the updates and there are no updates available. What do I do?

    Hi,
    I can't open D7200 NEF files with Photoshop CS6.I checked the updates and there are no updates available.What do I do?
    Nitin

    For the time being, shoot JPEG images. At this time there is no support for NEF files from the D7200 in any Adobe product. It was released at such a time that it wasn't included in the last Camera Raw update. And Lightroom hasn't been updated either. Consequently, there is no DNG converter available at this time. We will have to wait and see what programs will be able to accommodate the D7200 when Adobe releases updates or upgrades that support the camera.

  • I' can't open images or files with trial version of Photoshop cc

    I' can't open images or files with trial version of Photoshop cc. Photoshop starts, it seems ok, but don't work.
    Illustrator cc works very well. Why?

    1. I open Photoshop cc Trial version
    2. I click "continues with the trial version" (in italian version)
    3. File>Open> psd (cs5) or jpeg files
    I can't even open a new document. (File>New> etc..)
    All files can be opened by Paint, Ilustrator etcc.  Only Photoshop doesn't work.
    I just see this

  • How can I open a cpr- file with snow leopard ?

    How can I open a " cpr " file with my Mac OS X 10.6.8. ?

    Thank you for your fast reply ! The recommended software referes to video data. I received the cpr file from the ALDI fotobook software, if a want to secure a footobook layout. Therefor cpr must be a foto file.

  • Access JAR File while running App with Java Web Start

    Hello guys,
    I want to delpoy my application so that I can run it when I click on the appropriate button in a web page.
    I have a Jar file for all the files that the app needs. No, not all of the files are included.
    Indeed, I use JAR files such jdom.jar or postgres...jar that I must use in within my application.
    How can I access these JAR files knowing that I can't point to files in a JAR file A from within a JAR file B, if the JAR file B contains the JAR file A?
    The main JAR file that I put on the web server can be seen as the JAR file B and the other JAR files must be stored somewhere for the java classes within the main JAR file to have access to them.
    I wonder whether there is another way to structure the project.
    Thanks.

    Hi Andrew.
    I have followed your suggestions and here is what my .jnlp file look like:
    <tt>
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/koedops" href="beta.jnlp">
         <information>
              <title>KOEDOPS</title>
              <vendor>Pr. Fischer</vendor>
              <homepage href="http://localhost:8080/" />
              <description>Downloading koedops with Java Web Start</description>
         </information>
         <resources>
              <j2se version="1.6+" />
              <jar href="beta.jar" main="true"/>
              <jar href="jcalendar-1.3.3.jar" />
              <jar href="jdom.jar" />
              <jar href="postgresql-8.4-701.jdbc4.jar" />
         </resources>
         <application-desc main-class="general.Application" />
    </jnlp>               
    </tt>
    The three other jar-files reside in the same directory as the .jnlp file and the beta.jar file on the tomcat server.
    When I launch the application though nothing happens upon the download. In contrast, if I change the main class to a class file that requires no extra library, it runs perfectly.
    I can't be sure whether the jar-files are successfully accessed.
    Regards.
    Edmond

  • JFrame running with Java Web Start

    I have a problem with running my application with Java Web Start. My main application window is a JFrame and I have a line of code as below
    this.setExtendedState(MAXIMIZED_BOTH);
    It runs fine when run on a PC locally. But if I try to run the application through Java Webstart I get an exception. Can anyone help me with this. I would like the JFrame to open maximized.
    TIA.

    try posting the exception to get better answers. but anyway, i'm guessing its a security issue... your app is trying to access the properties of the local system. you might have to sign your application for this to go away.

  • Problems with Java web start

    Hi All,
    I am facing a problem with Java Web Start. Which is the most appropriate version of JDK recommended for SAP XI? I tried
    JDK 1.4.2_04
    JDK 1.4.2_09
    JDK1.4.2_11
    JDK1.5.0_01
    When I click on Integration repository or Directory for the first time, it loads the jar files and while loading, I get an error msg "Unable to launch Integration Builder". After a lot of retries I get sucess. But still we are facing this issue in some machines. Can you pls let me know if there is any pre configuration or some thing I am missing...
    Regards,
    Jai Shankar

    Did you check the proxy settings in JAVA Web start. Please follow the below instructions.
    This could be set to None or to specific for values HTTP Proxy and HTTP Port .
    Contact your network administrator for the correct settings. 
    To change the Proxy Settings:
    Select Windows Start menu -> All Programs -> Java Web Start -> Java Web Start
    Choose File -> Preferences -> General
    Choose None to switch off the proxy settings or Manual to set the HTTP Proxy and HTTP Port.
    ChooseOK
    Close Java™ Webstart

  • Help with Java Web Start

    Hi everybody,
    I have a simple Java application that has a JFrame containing a TextField displaying some text inside it. I am using the NetBeans IDE. I am trying to Enable Java Web start for this application. The steps I have taken upto now are:
    1. Right click on Project, Java Web Start -> Enable Java Web Start. This created the jnlp file.
    2. In the Resources section, I added the jar file for swing. ( I am not sure if I have to add the path for jnlp.jar etc, or are these found automatically?)
    3. Right click on Project, Java Web Start -> Deploy with Java Web Start. This launches the browser with the Click me link, but on clicking this link, I get the following error.
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class jnlp.sample.servlet.JnlpDownloadServlet or a class it depends on
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.ClassNotFoundException: jnlp.sample.servlet.JnlpDownloadServlet
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)I have all the jnlp files in my jdk directory, and I am not sure why it can't find it. Is there something I am missing?
    Thanks
    George

    I am not sure what it has to do with servlets, I just followed a tutorial on using Netbeans with Java Web Start, and did only the steps as mentioned in my first post. And ended up with the error.
    Anyways, I added the jnlp jar files(jnlp.jar, jnlp-servlet.jar, jardiff.jar) in the WEB-INF/lib directory. And it seems to deploying it now. I can get my application to load on clicking on the "Click me" link. But the controls on my application don't seem to be working.
    Also, when I try to Right click on my project -> Java Web Start -> Run with Java Web Start, I get the following error message,
    javaws-run: C:\Documents and Settings\Lux\Visualization\nbproject\build-jaws-impl.xml:36: Execute failed: java.io.IOException: CreateProcess: C:\j2sdk1.4.2_13\bin\javaws "file:///C:/Documents and Settings/Lux/Visualization/Visualization.jnlp" error=2
    BUILD FAILED (total time: 0 seconds)
    Any help appreciated.
    Thanks.
    George

  • How can I connect to a database using Java Web Start?

    When I run the application without Java Web Start, the program can get the driver and connect to the database. However, when I try to use this same application with Java Web Start, the program can not load the driver. Why is this happening? I am using a mySql database driver.

    I assume you are trying to connect using JDBC, are did you include the jdbc jar in your resources ?

  • Err. in programs copiled with Jdev 9.0.3 and run with Java Web Start

    Hi all,
    when I build my programs with Oracle9j JDeveloper 9.0.3.988 and I use them with Java Web Start, programs do not run, while when compiled with Oracle9j JDeveloper 9.0.2.x it runs without problems.
    The Java version used in both cases is 1.4.0.
    Here's an example of the log from Java Web Start:
    Error in JavaWeb Start
    viewer/imageViewer/ViewerAppState$1 (Illegal Variable name " val$files")
    java.lang.ClassFormatError: viewer/imageViewer/ViewerAppState$1 (Illegal Variable name " val$files")
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at com.sun.jnlp.JNLPClassLoader.defineClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.access$1(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
         at viewer.imageViewer.UtilityMenuPane.jbInit(UtilityMenuPane.java:167)
         at viewer.imageViewer.UtilityMenuPane.<init>(UtilityMenuPane.java:155)
         at viewer.imageViewer.UtilityMenuPane.getInstance(UtilityMenuPane.java:147)
         at viewer.imageViewer.ImageViewerFrame.jbInit(ImageViewerFrame.java:179)
         at viewer.imageViewer.ImageViewerFrame.<init>(ImageViewerFrame.java:145)
         at viewer.imageViewer.ImageViewerFrame.getInstance(ImageViewerFrame.java:126)
         at viewer.ImageViewer.execute(ImageViewer.java:30)
         at viewer.Viewer.execute(Viewer.java:63)
         at viewer.Viewer.<init>(Viewer.java:27)
         at viewer.Viewer.main(Viewer.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:536)
    Does anybody know why this happens?
    Thanks

    Hi There.
    We had the same problem with some of our code. We moved the definition of the class from a method out of the method. Like this:
    public class{
    class{
    instead of doing this:
    public class{
    method() {
    class{
    This worked with the web start......
    Best regards
    Jesper Lorentzen

  • Using Berkeley Java Edition with Java Web Start

    Hi
    Have anyone had any experience using Berkeley Java Edition with Java Web Start?. I need to create an application that will download with the database to a client computer and create the database there

    Thanks for your reply Luca-Sanna,
    This is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/dist" href="launch.jnlp">
    <information>
    <title>MyApplication</title>
    <vendor>My Company</vendor>
    <homepage href="/test.html"/>
    <description>My Test Application</description>
    <description kind="short">My Application</description>
    <icon href="test.gif" kind="default"/>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="myapp.jar" main="true" download="eager"/>
    <jar href="lib/appframework-1.0.3.jar" download="eager"/>
    <jar href="lib/beansbinding-1.2.1.jar" download="eager"/>
    <jar href="lib/commons-beanutils.jar" download="eager"/>
    <jar href="lib/commons-collections.jar" download="eager"/>
    <jar href="lib/commons-digester.jar" download="eager"/>
    <jar href="lib/commons-logging.jar" download="eager"/>
    <jar href="lib/derby.jar" download="eager"/>
    <jar href="lib/derbyclient.jar" download="eager"/>
    <jar href="lib/derbynet.jar" download="eager"/>
    <jar href="lib/itext-1.3.1.jar" download="eager"/>
    <jar href="lib/jasperreports-1.3.0.jar" download="eager"/>
    <jar href="lib/jbossall-client-2004-05-11.jar" download="eager"/>
    <jar href="lib/jdt-compiler-3.1.1.jar" download="eager"/>
    <jar href="lib/poi-2.0-final-20040126.jar" download="eager"/>
    <jar href="lib/swing-worker-1.1.jar" download="eager"/>
    <jar href="lib/toplink-essentials-agent.jar" download="eager"/>
    <jar href="lib/toplink-essentials.jar" download="eager"/>
    </resources>
    <application-desc main-class="mypackage.Login">
    </application-desc>
    </jnlp>
    I have seen many forums with the same above problem with no reply.
    Anyone knows what exactly the problem is?

  • Issue Downloading Resources with Java Web Start

    I'm having an issue with Java Web Start downloading resources. After executing the JNLP file, the download will start and the main Jar will download, then the download will just stop. The downloader is still running, but the progress bar just sits and nothing happens. This only will happen on some machines, even ones on the same network. Others download fine, and the application starts correctly. I thought maybe a setting with java web start needed to be changed, but the proxy settings are set to the browser, which are the same for all machines. The JNLP file is below (however, for security reasons the codebase/homepage are left out, but they are correct in the actual file). Does anyone have any idea of what the problem might be?
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
         <jnlp codebase="..." spec="1.0+">
         <information>
         <title>Java3D Test</title>
              <vendor>None</vendor>
              <homepage href="..." />
              <description>Test application for Java3D</description>
         </information>
         <update check="always" />
    <security>
         <all-permissions/>
    </security>
    <resources>
              <j2se version="1.5+"/>
         <jar eager="true" href="TestJava3D.jar" main="true" />
              <jar href="lib/Library.jar" />
              <jar href="lib/Java3D.jar" />
              <jar href="lib/j3dnative.jar" />
         </resources>
    <application-desc main-class="testjava3d.TestJava3DMain">
    </application-desc>
    </jnlp>

    You could enable JavaConsole and turn on tracing to get more debugging info. See: http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html#gcexdf

Maybe you are looking for

  • 2 Ipods, 1 computer with one user account

    To put my question very simple. I have 2 Ipods, one called Andy's Ipod, which is installed and shows up in the Source window when I plug it in, and another Ipod which I can't get to work. Is it possible for the other one to also show up in the Source

  • Problem Installing my new graphic card 760GTX Stucks on HP Splash Screen

    I'm using a h9-1185 Windows 7 and I thought I'd update my graphic card from a 7870 to GTX 760 but that was easier said than done. When I try to boot my computer with the new card it stays at the hp splash screen. The GPU is correctly installed I have

  • HP officejet pro 8500 A909g Can not send emails from scan to e mail & Forward My Fax on Emails

    I have Windows 7 home Premium os, My earlier router malfunctioned so have installed new Dlink router DSL-2750U and after that i am not able to use scan to email & Fax to email options. Email id to forward mail is a gmail id. Please advice

  • IPhoto 11: lost all photos., iPhoto 11: lost all photos.

    Hi, I've lost all my iPhoto library.  I've read all the similar posts and have rebuilt thumbnails, repaired and rebuilt database and still nothing.  It looks like the photos are completely gone from my macbook air, but I don't know how this could hav

  • ** Not able to Import RFC - RFC to RFC scenario

    Hi Friends, I have created one technical system in SLD which is already configured with XI system. I have created one business system for this technical system. I have created one SWCV and one namespace. Now, I have tried to import one RFC under 'Imp