Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8906333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:37:34+00:00 2026-06-15T02:37:34+00:00

I need to register the file association for a certain file type – in

  • 0

I need to register the file association for a certain file type – in fact, I just need to launch a certain Java program with certain arguments and a name of that file.

I got as far as the following:

// in fff-assoc.cmd file:
assoc .fff=SomeFile
ftype SomeFile=java -jar some.jar <arguments1> "%%1" <arguments2>

It works properly for ASCII file names. But when I try to double-click some file with non-ASCII symbols in name, the argument passed looks like “????” (int value of each char = 63).

How can I fix those associations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:37:37+00:00Added an answer on June 15, 2026 at 2:37 am

    If what bobince says is accurate and you cannot reliably get the data to java directly, one alternative solution would be to write a small “shim” program in another language (e.g. C, C++ or C#).

    The idea is that the program grabs the input as UNICODE, encodes it so that it’s expressible using only ASCII characters (e.g. by using base64, or even something as simple as encoding every character as its numerical equivalent) and then assembles the command line argument to use and launches java itself using CreateProcess.

    Your Java code could “undo” the encoding, reconstructing the UNICODE name and proceeding to use it. It’s a bit of a roundabout way and requires an extra component for your software, but it should work around the restriction detailed above, if indeed that is an actual restriction.

    Update: This is the basic code for the shim program. It encodes input as a sequence of integers, separated by colons. It doesn’t do much in the way of error checking and you might want to improve it slightly, but it should at least get you started and going in the right direction.

    You should grab Visual Studio Express (if you don’t already have Visual Studio) and create a new Visual C++ project, choose “Win32” and select “Win32 Project”. Choose “Win32 application”. After the project is created, replace everything in the .cpp file that is displayed with this code:

    #include "stdafx.h"
    #include <string>
    
    int APIENTRY _tWinMain(HINSTANCE, HINSTANCE, LPTSTR lpCmdLine, int)
    {
        std::string filename;
    
        while((lpCmdLine != NULL) && (*lpCmdLine != 0))
        {
            if(filename.length() != 0)
                filename.append(":");
    
            char buf[32];
    
            sprintf(buf, "%u", (unsigned int)(*lpCmdLine++));
    
            filename.append(buf);   
        }
    
        if(filename.length() == 0)
            return 0;
    
        PROCESS_INFORMATION pi;
        memset(&pi, 0, sizeof(PROCESS_INFORMATION));
    
        STARTUPINFOA si;
        memset(&si, 0, sizeof(STARTUPINFOA));
        si.cb = sizeof(STARTUPINFOA);
    
        char *buf = new char[filename.length() + 256]; // ensure that 256 is enough for your extra arguments!
    
        sprintf(buf, "java.exe -jar some.jar <arguments1> \"%s\" <arguments2>", filename.c_str());
    
        // CHECKME: You hard-coded the path for java.exe here. While that may work on your system
        // is it guaranteed that it will work on every system?
    
        if(CreateProcessA("C:\\Program Files\\Java\\jre7\\bin\\java.exe", buf, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
        {
            CloseHandle(pi.hThread);
            CloseHandle(pi.hProcess);
        }
    
        delete[] buf;
    
        return 0;
    }
    

    You should be able to figure the details on how to compile and so on fairly easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to register a file type (e.g. .exex files) when my application is
i am developing register form using php where i need to upload the file
I have a new service that I have written and need to register it
How to make activities that register BroadCastReceiver? Because I need to close all the
I need to register an assembly in the GAC using batch file. Is there
i have made user-register.tpl.php file. And i have set many text field in that.
I have decided that all my WPF pages need to register a routed event.
I have a file named cpu.h that includes two other headers named register.h and
I need to register a javascript file from code-behind. I am interested to know
I need to run a batch file which needs to register a DLL. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.