B4J Question Publishing To Windows Store Problems

keirS

Well-Known Member
Licensed User
Longtime User
I tried to use the store packager tool to publish to the windows store but the builder use does not support JPOI. So I built the package manually using the B4JPackerger11 and MS Desktop Packager Tool. I can create the APPX package OK and it will install but it doesn't run.

Running process monitor it appears that Java is run but it is looking in the wrong place for the release_java_modules.txt

B4X:
High Resolution Date & Time:    09/05/2019 10:26:49.8739609
Event Class:    File System
Operation:    QueryDirectory
Result:    NO SUCH FILE
Path:    C:\Windows\System32\release_java_modules.txt
TID:    3224
Duration:    0.0000225
Filter:    release_java_modules.txt

I think it maybe running Java from the wrong place as well since it is showing access to:

B4X:
High Resolution Date & Time:    09/05/2019 10:26:49.8063438
Event Class:    File System
Operation:    CreateFile
Result:    SUCCESS
Path:    C:\ProgramData\Oracle\Java\javapath
TID:    14216
Duration:    0.0000892
Desired Access:    Read Attributes
Disposition:    Open
Options:    Open Reparse Point
Attributes:    n/a
ShareMode:    Read, Write, Delete
AllocationSize:    n/a
OpenResult:    Opened

C:\ProgramData\Oracle\Java\javapath is the entry in my command line path.
 
Last edited:

keirS

Well-Known Member
Licensed User
Longtime User
Solving my own problem. I changed the C# code in B4JPackeger11 to:

B4X:
File.WriteString(TempFolder, "runner.cs", $"
  
using System;
using System.Diagnostics;
namespace B4JRunner
{
    class Program
    {
        static void Main(string[] args)
        {
              
            string StartDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            Process p = new Process();  
            p.StartInfo.FileName = "javaw.exe";
            if (StartDir.Length > 0)
            {
                p.StartInfo.WorkingDirectory = StartDir + @"\bin";
            }
            else
            {
                p.StartInfo.WorkingDirectory = @"bin";
            }
          
            p.StartInfo.Arguments = "@release_java_modules.txt -m ${TargetModule}/${PackageName}.main";
            p.Start();
        }
    }
}"$)

According to this Stack Overflow post that's the best way to get the start location for APPX installation. This returns an empty string when run straight from windows so I just kept the current WorkingDirectory setting if StartDir is zero length. There is probably a better way of doing it but it works.
 
Upvote 0
Top