How to make my program default to open a file type?

Asked

Viewed 3,295 times

7

I have a Java application that is very simple, represents a form and, based on what is typed in your JTextField, a file called "formulario.uniXml" is created. I set the extension to this name already to leave it as the default of my system.

What I want is: When the user double-click the file with extension ". uniXml", this file is opened by my application and its contents are loaded into JTextFields

Thank you if you have an example or link to an existing open topic. Thank you.

  • Welcome to Sopt, it would be great if you show us what you have tried to do, also I suggest you take a tour to learn how to ask:https://answall.com/tour

  • 1

    http://www.rgagnon.com/javadetails/java-0592.html

  • Good evening Renan, I haven’t tried anything of the kind, so far I have been able to convert my jar program to an exe, so I can associate the file type . uniXml to my software by Windows. However, when I double click on a file of this type, it calls my application without uploading the contents of the file. My file is a common xml and I need my application to work with this xml as word works with a . docx (double click on docx and it opens the word with the contents of the file)

  • Good evening guys, I just saw the link from Onosendai up on the comments. It was perfect, it was exactly what I needed. Thank you very much.

1 answer

1

What is Java Web Start and how it is started?

Java Web Start software allows you to download and run Java Web applications. Java Web Start software:
  • Enable apps easily with just one click.
  • Ensures that the latest version of the application is always running.
  • Eliminates complex installation or upgrade procedures.

How to get the Java Web Start software

Java Web Start has been included in the Java Runtime Environment (JRE) since the release of Java 5.0. This means that during the installation of Java, Java Web Start is installed automatically. Java Web Start software is automatically booted when a Java application using Java Web Start technology is downloaded for the first time. Java Web Start software caches (stores) the entire application locally on your computer. Therefore, any subsequent startup will be virtually instantaneous because all required features are already available locally. Every time you boot an application, the Java Web Start software component checks the application’s website to see if a new version is available and, if it is, automatically downloads and boots it.

To boot an application using Java Web Start software:

In a browser

Click a link from a web page.

In the desktop icon

If you use an application often, you can create a shortcut on your desktop or Start Menu. Java Web Start may ask you if you would like to create shortcuts or an entry in the Start Menu. If you answer Yes, all future application startups can start without a browser.

In the Java Application Cache Viewer

Java Web Start also provides a Java Application Cache Viewer that you can start in the Java Control Panel. Cache Viewer allows you to directly boot downloaded applications.

Instructions to start in the Java Application Cache Viewer

  1. Go to Initialize > Settings > Control Panel > Double-click the Java icon. The Java Control Panel will initialize.
  2. Click on the General tab
  3. Click the View button in the Temporary Internet Files section
  4. In the list shown, double-click the application you want to start.

Image
(source: java with.)

At the command prompt

You can also start an application via a command prompt by typing javaws jnlp_url, where jnlp_url is a URL for the application’s jnlp file.

  1. Go to Start > Run > type command A command prompt window will appear.
  2. Type javaws url_of_jnlp

MORE TECHNICAL INFORMATION

Java Web Start Developer Documentation

  • But as this will make the operating system associate that all files with extension .uniXml should be opened in his program?

  • 1
    1. Create a signed and executable JAR from the application. 2. Create a JNPL, an XML file that will basically set as file will run. 3. Starting the programme.
  • @guiandmag what would a signed JAR be? And how do you do that?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.