Jfilechooser vs jnlp

The tutorial on jfilechooser says that for a webstart app one should use the jnlp api instead of jfilechooser, but they don't say why...if I am writing a program intended to be a fat client that has access to files on the user's machine, which should I use?
Thanx

Stop crossposting. This Angela already posted that stuff in here, and I already visited your thread in the JNLP forum.

Similar Messages

  • JFileChooser  and JNLP

    I am trying to use this code to be able to open a file:
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/FileChooserDemo.java
    When I run it with NetBeans, it works...
    But when I try to run my .jnlp file nothing happens....
    I've been trying to figure out how to get JFileChooser to work with JNLP and I am not getting anywhere. Any advice?

    Stop crossposting. This Angela already posted that stuff in here, and I already visited your thread in the JNLP forum.

  • JNLP FileOpenService vs JFileChooser getPath()

    In my Web Start application, I'm trying to browse a directory and remeber the path to specific folders/files. I've managed to perform all the security coding to read in files with FileOpenService, but I've read that there is no way to actually remeber the location on the host computer where that file came from.
    I would eventually like to use the mkdir() function in a selected directory and I don't want my users to have to manually select a "home" directory every time. Is there any way to get around this like JFileChooser's .getPath() function?
    Thanks Much,
    Daniel

    It should be easy enough to write a small abstract class or interface with two concrete implementations, one for each environment, so that the rest of your program doesn't care which is in use.

  • JFileChooser and security

    Has anybody got the JFileChooser to open the user.dir or user.home directory? [I have used JFileChooser(".")] I have used the policytool to generate a policy file and also have tried to follow Irene's 10 steps to signing an applet but non have worked. I keep getting the security exception thrown that access denied to user.home or user.dir. Does anybody have an example policy file and a snippet of the JFileChooser code they used to open the local file system without getting a security exception throw? Any help would be much appreciated!
    Thank you in advance,
    dave

    The Notpad demo uses the JNLP api to read and write files. The api doc can be found at:
    http://java.sun.com/products/javawebstart/docs/javadoc/index.html
    Although the Notpad demo source is not available, there is other sample code available at:
    http://developer.java.sun.com/developer/releases/javawebstart/
    Included here is the webpad demo, which uses the FileOpenService and
    FileSaveService API's.

  • Problem with .jnlp file

    Hello,
    I am trying to use JFileChooser to open and select a file. I am using NetBeans to develope my application. When I run it in NetBeans it works just fine and I can open and select the file. However, when I run my .jnlp file and click on the button nothing happens. Why is that? Here's a sample of my code:
    private JButton getBtnJFileChooser() {
         if (btnJFileChooser == null) {           
    btnJFileChooser = new JButton("Open...");
    btnJFileChooser.setBounds(275, 110, 90, 20);
    btnJFileChooser.addActionListener(new OpenAction());
         return btnJFileChooser;
    class OpenAction implements ActionListener {
    public void actionPerformed(ActionEvent ae) {
    // Open a file dialog
    fc = new JFileChooser();
    int retVal = fc.showOpenDialog(SC_DOC_gui.this);
    if (retVal == JFileChooser.APPROVE_OPTION) {
    // The user selected a file, process it
    File file = fc.getSelectedFile();
    // Update user interface.
    //lblMsgArea.setText(file.getName());
    lblMsgArea.setText("Load SC_DOC Files");
    }

    I am not quite sure what's going on. When the button is clicked nothing happens. I've been doing research on this and I found a sample code that deals with jnlp and opening files. It's here: http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html#advancedexample
    Now, when I want to use this code I get an error message that the package javax.jnlp.* does not exist. So now I'm trying to figure that one out and I haven't yet. I have installed the latest Java Web Start Technology and this should work. Any advice?

  • Why JFileChooser doesn´t show when using JWS?

    I have this code where a JFileChooser is shown and the user must choose a directory where JasperReport must be exported to Excel.
    Everything works fine when running locally (the jar file) but when I put in the server and my client runs it using JWS the JFileChooser dialog doesnt show up.
    I am aware that the JNLP must have all-permissions, and it is but still does not show the diago to select the directory. And worse, no exceptions are shown else well.
    final JFileChooser fc = new JFileChooser();
    int choice = 0;
    try {
         fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
         System.out.println("1"); // DOES NOT REACH THIS LINE
         fc.setDialogTitle("Select Directory to Export");
         System.out.println("2");
         fc.setApproveButtonText("Select");
         System.out.println("3");
         fc.setMultiSelectionEnabled(false);
         System.out.println("4");
         fc.setCurrentDirectory(new File("C:/Kooky/SigGraf"));
         System.out.println("5");
         choice = fc.showOpenDialog(frame);
         System.out.println("6");
    } catch (Exception ex) {
         ex.printStackTrace();
    if (choice == JFileChooser.APPROVE_OPTION) {
         Thread worker = new Thread() {
              @Override
              public void run() {
                   String msg = "";
                   try {
                        File dir = fc.getSelectedFile();
                        String local = dir.getPath();
                        msg = Report.exportarParaExcel(startDate, endDate, local);
                   } catch (Exception ex) {
                        ex.printStackTrace();
                   final String msg2 = msg;
                   SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                             JOptionPane.showMessageDialog(frame, msg2);
         worker.start();
    } else {
         JOptionPane.showMessageDialog(frame, "You did not select a directory to export the report.");
    }The JNLP file:
         <security>
              <all-permissions/>
         </security>
    All the jars are signed with the same certificate.

    FranzAnthony wrote:
    Amazing your answer, you asked for exactly what I posted, thanks a lot for your help, let it be.Please read the SSCCE link again, as it isn't "exactly" what you posted. It's so much easier to answer questions when a nice compilable and runnable example has been provided by the OP. You are not required to do this of course, but if you do provide one, the odds of getting a quick helpful answer will be greatly increased.
    Or you can post a snarky comment and antagonize all the rest of the forum regulars who otherwise would have helped you. Your call.

  • NetBeans vs. JNLP

    I am working on an aplication that requires opening a dialog, searching and then selecting a specific file. I would like to use the .jnlp file to run the application after it is done. I've done my research and this is what I found out....
    When working in JWS environment I need to use FileOpenService that is part of javax.jnlp.*. However, if I use this method it does not work in NetBeans....
    On the other hand, when working in NeBeans environment I need to use JFileChooser. However, this method won't work in JWS environment.
    What's the solution to this problem? Is there a method that works in both environments? Will I have to use both ways simultaneously?
    Thanks

    It should be easy enough to write a small abstract class or interface with two concrete implementations, one for each environment, so that the rest of your program doesn't care which is in use.

  • JavaWS JFileChooser Problem

    Hi there, i am trying to use javawebstart to deliver my application.
    By now i loaded some resources stored inside the jar of the application using the
    functionalities provided by java.
    However when i try to open a file in the user file system,
    or particularly when i create a new JFileChooser window.. a security exception is thrown..
    I referred to this article to reconstruct a similar version of jFileChooser for resources inside
    the jar file. http://forum.java.sun.com/thread.jspa?threadID=646569&messageID=3807781
    Have you any idea on how to load userspace file avoiding security exceptions?
    Thanks Andrea
    P.s.
    I already posted this topic in the wrong place :( i hope this is a more correct one.
    And you can heko me.

    in another message i found out this 2 possible solutions:
    "You can use the jnlp api for FileOpenService/FileSaveService, or use signed application"
    however my application is signed as you can see here:
    and i still have that error..
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://tallia1.myftp.org/shared-folder/">
    <information>
    <title>My Java Parametrizer</title>
    <vendor>Andrea Tagliasacchi @ SFU </vendor>
    <homepage href="http://tallia1.myftp.org" />
    <description>Demonstration of JNLP</description>
    </information>
    <offline-allowed/>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.2+" />
    <jar href="./myJavaParametrizer.jar"/>
    <jar href="./jogl.jar"/>
    <property name="sun.java2d.noddraw" value="true"/>
    <property name="ATI_WORKAROUND" value="false"/>
    </resources>
    <resources os="Windows">
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <nativelib href="lib/jogl-natives-win32.jar"/>
    </resources>
    <resources os="SunOS" arch="sparc">
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <nativelib href="lib/jogl-natives-solsparc.jar"/>
    </resources>
    <resources os="Linux">
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <nativelib href="lib/jogl-natives-linux.jar"/>
    </resources>
    <resources os="Mac OS">
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <nativelib href="lib/jogl-natives-macosx.jar"/>
    </resources>
    <application-desc main-class="gui.smf_view" />
    </jnlp>

  • .jnlp And Mutiple Stage Problem

    When I made programe by javafx with single stage(on NetBeans) and build it.The .jnlp file can work well.
    But when I create multiple Stage (in same javafx file),it work well on NetBeans.But when I build it.The .jnlp file can't work(Not any stage appear and Not any Error Dialog appear).
    How can I do to this problem.TT
    Thank you very much.
    Ps. Sorry,that my english skill isn't work well. TT

    Your application runs fine when launched with:
    D:\Java\javafx-sdk1.2.1\bin\javafx -jar CodePaint_JavaFX.jarNext, I modified the JNLP file to launch the application from local disk (using file:. as codebase value).
    I get an error message in the Java console (always activate it when testing applets!):
    Could not launch from cache. Will try online mode. [Missing from the cache: file:CodePaint_JavaFX.jnlp]
    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.io.Win32FileSystem.getUserPath(Unknown Source)
         at java.io.Win32FileSystem.resolve(Unknown Source)
         at java.io.File.getAbsolutePath(Unknown Source)
         at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2.createShellFolderFromRelativePIDL(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2.getRecent(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
         at sun.awt.shell.ShellFolder.get(Unknown Source)
         at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(Unknown Source)
         at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
         at javax.swing.JComponent.setUI(Unknown Source)
         at javax.swing.JFileChooser.updateUI(Unknown Source)
         at javax.swing.JFileChooser.setup(Unknown Source)
         at javax.swing.JFileChooser.<init>(Unknown Source)
         at javax.swing.JFileChooser.<init>(Unknown Source)
         at Main.javafx$run$(Main.fx:79)So your code use the JFileChooser. For some reason, JNLP launches have same security policy than applets, so when you access the file system (among others), you have to sign the jar.

  • .jnlp downloading to wrong folder

    Ok, this is totally strange. Now my Java applet is downloading to http://www.finncraft.com/wp-content/uploads/2013/04/java.png
    Please look at the path that it is downloading to. VERY STRANGE.
    Yes, I do have Safari settings to download all files to the Download Folder.
    But why would it download to the Private Folder.
    I did not even know that I had this folder.

    To lessen the risk of malware infection, Safari now downloads Java WebStart application files to a hidden temporary folder and does not open them automatically. Although you may find instructions on the Internet for defeating this protection, I strongly advise against doing so.
    The right way to launch a WebStart application is to click the Downloads button at the right end of the Safari toolbar and then double-click the icon of the JNLP file you just downloaded. If you want to save the file for later use, click the magnifying-glass icon to reveal it in the Finder, and then move it. Otherwise it will be deleted at the next login.

  • No Disk Error when opening JFileChooser

    Hi all
    After launching my app via JWS and opening my apps FileChooser I get a 'javaw.exe - No Disk' error message:
    'There is no disk in the drive. Please insert a disk into drive A:.'
    This doesn't happen if I start the app without JWS. Although it happens only the first time after opening the FileChooser it's rather annoying for the user. I can't expect the user always having a disk in their drive.
    Is there a way of switching the scan for drive A off?
    Thanks for your help.
    Stephan

    See Top 25 Bugparade: # 4264750
    This is a SecurityManager - Problem and the java.io.File.
    eg.:
    System.setSecurityManager(new RMISecurityManager());
    File[] roots = File.listRoots();
    Then you will see the problem...
    I tried the following workaround:
    before you access disk. (or JFileChooser)
    SecurityManager sm = System.getSecurityManger();
    System.setSecurityManager(null);
    // disable the SecurityManger
    // this special disk access needs no SecurityManager..
    ... popup JFileChosser or make FileAccess..
    System.setSecurityManager(sm);
    // restore the old SecurityManger
    It's not the best solution but it works..
    hope this will help,
    Wolfgang
    EDI Organisation

  • Error in downloading jars through jnlp from Oracle 10.1.3 App Server

    I am working on migrating an application (containing two WARs) from Resin servlet server to Oracle 10.1.3 App Server. The migration was unit tested successfully. One of the WARs was implemented as a web service that downloaded JARs to the client PC through jnlp. When I tried to combine the two WARs into one (application) WAR, some of the JARs failed to download with an error message stating that they were "corrupted". 5 of the 6 "corrupted" contain native code, although two other native code JARs were able to download successfully.
    Most of the time the jnlp failure was accompanied with this error: WARNING: Exception returned by remote server: {0}
    javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details
         at com.evermind.server.rmi.RMIClientConnection.handleLookupResponse(RMIClientConnection.java:819)
         at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:283)
         at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
         at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
         at java.lang.Thread.run(Thread.java:595)
    Error: Unexpected error during lookup : Lookup error: javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details; nested exception is:
         javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details
    Why is the jnlp failing when the WARs are part of the (main) application, but OK when it is part of a web service WAR? How can I overcome this problem?
    Thanks for your help.

    Hi Marc ,
    Thanks for your reply.....
    Did you mentioning the script (upgrade_10131_
    10133_oracle.sql) in the orabpel. I had run this script after applying the patch.
    Still iam facing the same issue.
    what need to be done?
    Could you please help me on this, because I need to do the Fault Handling Framework in BPEL and so i need the faultpolicy folder to be present.
    Since I got the folder by applying the patch, but what happend is when i try to check out for the activity status in the BPEL Console Activity tab it is showing the error as mentioned earlier. Any problem with patch implementation or any bug is there. So far i done the patch installation successfully without error and i upgraded the orabpel schema using the mentioned script also. Any other things i need to do?
    Regards,
    Ashok.

  • Can not sort the files in JFileChooser if the files are from remote machine

    Hi All,
    Let me set the context of the question.
    I have extended the JFileChooser to support the listing/view of files.dirs etc of remote location through CORBA.To achieve that i have customized
    my FileSystemView to support it. In general ,the current JFileChooser sorts the file when we have details view .My question is related to this.The default
    JFileChooser has the support for sorting but when i customized the FileSystemView,the sorting functionality is no more exist.I tried with TableRowSorter as well but
    the sorting can be achieved in View only,the model still remains same as initial.
    Any pointer towards this will be highly appreciated.
    Thanks
    Praveen

    Can anyone help me out to solve this problem or any suggestion regarding this ?
    Regards
    Praveen

  • If I want to set -Xbootclasspath , how to do it in jnlp file

    if I want to set -Xbootclasspath to let jvm know my classpath, how to do it in jnlp file. or have other way to do it.

    If I want to orb, (now I am using openOrb) , I had to
    let jvm load Orb which I want to use. Did you put those Orb classes into jars and list them in the jnlp file of your Web Start app?
    Regards,
    Marc

  • JFileChooser (again!) slow in JRE 1.6.14 on some machines, not others

    I am running ImageJ (from the NIH) on several of our machines and on some machines JFileChooser is lightning fast, while others exhibit the same slowness spoken of in another JFileChooser thread that is now in a locked state. We open large image files (tif, png) located on our SAN and from the network traffic I see in Windows Task Manager while opening a folder containing the images I would guess that JFileChooser is actually opening the files (intentionally or not), not just obtaining a folder listing. It's similar to the same issue of opening a large folder of images with the view set to thumbnails - it takes about the same amount of time. I have tried the suggestions in that thread to no avail - the environment the machines are running is:
    Windows XP SP3
    Java JRE 1.6.0_14
    Can anyone comment on what JFileChooser is doing and how I can get it to stop this? Is it a Windows environment setting so that the native API calls made by JFileChooser will behave differently? Thoughts?
    Thanks,
    Tom

    I can't be absolutely sure, but we have several seemingly identical machines used for the purpose of reading medical images and several of them appear to work correctly (very fast loading and population of the folder's contents) and others don't. I have been using eclipse to enhance the software tool we're using (ImageJ) and using the debugger I can see that when the JFileChooser object is being instantiated and populated with entries a tremendous amount of network traffic occurs. This network traffic is equivalent to the amount I see when the same folder is opened in My Computer using a thumbnails view of the folder contents. Apparently, the network is delivering approximately 300-400 MB of images. As far as configuration of the Windows machines is concerned I haven't found a significant difference yet, though I admit I am not a Windows desktop admin and may not know of some configuration item that could be responsible. I assume (though could be mistaken) that both My Computer and JFileChooser are ultimately using similar API calls to get the folder content entries?

Maybe you are looking for