Menu

#229 Launcher hides specific symbols from bundled jar

3.x
open
nobody
6
2023-02-18
2023-02-07
No

Hello!
Have found a bug when application is called with unicode symbols in arguments.
Actually they are not supported by java.

I need to start with a little background to let you understand the main trouble:

Just using java to get calling arguments will modify them and it can affect on application working:

For example: calling application with file argument in path:

C:\files\İnteraktif Vergi Dairesi.webarchive

your file path will be transformed to:

C:\files\Interaktif Vergi Dairesi.webarchive

as you may notice symbol İ will be replaced to I. So surprise: no file would be found on given location.

Any solutions?

One of the solutions is to use JNA to use Windows kernel libs to get real application arguments. One of examples described here: https://stackoverflow.com/questions/70546736/netbeans-chinese-characters-in-java-project-properties-run-arguments

So what's the point and why I created this issue?

If I use such kernel solution, I can get actual arguments from kernel and everything is fine - file path will be correct:

C:\files\İnteraktif Vergi Dairesi.webarchive

But if application jar will be bundled or wrapped by exe launcher - all arguments would be replaced by java default arguments processing, so actual arguments would be hidden by java:

C:\files\Interaktif Vergi Dairesi.webarchive

Jar bundled by launch4j-maven-plugin:2.3.2 via net.sf.launch4j.launch4j:3.5.0 under the hood.

Is there any ideas how to avoid this behavior?
If you need I can create a simple representing project.

Related

Bugs: #229

Discussion

  • Grzegorz Kowal

    Grzegorz Kowal - 2023-02-08

    Hello,

    I will check if I can reproduce this problem. Does it happen when you use
    launch4j JNI header?

    Grzegorz

    On Tue, Feb 7, 2023, 20:20 Eugene Zrazhevsky incrediblebd@users.sourceforge.net wrote:


    Status: open
    Group: 3.x
    Labels: arguments jni unicode
    Created: Tue Feb 07, 2023 07:20 PM UTC by Eugene Zrazhevsky
    Last Updated: Tue Feb 07, 2023 07:20 PM UTC
    Owner: nobody

    Hello!
    Have found a bug when application is called with unicode symbols in
    arguments.
    Actually they are not supported by java.
    I need to start with a little background to let you understand the main
    trouble:

    Just using java to get calling arguments will modify them and it can
    affect on application working:

    For example: calling application with file argument in path:

    C:\files\İnteraktif Vergi Dairesi.webarchive

    your file path will be transformed to:

    C:\files\Interaktif Vergi Dairesi.webarchive

    as you may notice symbol İ will be replaced to I. So surprise: no file
    would be found on given location.
    Any solutions?

    One of the solutions is to use JNA to use Windows kernel libs to get real
    application arguments. One of examples described here:
    https://stackoverflow.com/questions/70546736/netbeans-chinese-characters-in-java-project-properties-run-arguments
    So what's the point and why I created this issue?

    If I use such kernel solution, I can get actual arguments from kernel and
    everything is fine - file path will be correct:

    C:\files\İnteraktif Vergi Dairesi.webarchive

    But if application jar will be bundled or wrapped by exe launcher - all
    arguments would be replaced by java default arguments processing, so actual
    arguments would be hidden by java:

    C:\files\Interaktif Vergi Dairesi.webarchive

    Jar bundled by launch4j-maven-plugin:2.3.2 via
    net.sf.launch4j.launch4j:3.5.0 under the hood.

    Is there any ideas how to avoid this behavior?
    If you need I can create a simple representing project.


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/launch4j/bugs/229/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #229

    • Eugene Zrazhevsky

      Hello! Sorry, actually not. Using just gui mode.
      Appending my plugin config, I guess it can answer most questions and help to reproduce the problem:

      <plugin>
          <groupId>com.akathist.maven.plugins.launch4j</groupId>
          <artifactId>launch4j-maven-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
              <dontWrapJar>false</dontWrapJar>
              <headerType>gui</headerType>
              <jar>${project.build.directory}/${project.name}.jar</jar>
              <outfile>${project.build.directory}/${project.name}.exe</outfile>
              <chdir>.</chdir>
              <priority>normal</priority>
              <downloadUrl>https://adoptium.net/temurin/releases/</downloadUrl>
              <supportUrl>https://github.com/benchdoos/WeblocOpener/issues</supportUrl>
              <stayAlive>false</stayAlive>
              <restartOnCrash>false</restartOnCrash>
              <icon>${project.basedir}/build/installer/images/balloonIcon512.ico</icon>
              <classPath>
                  <mainClass>com.github.benchdoos.weblocopener.Main</mainClass>
                  <addDependencies>true</addDependencies>
              </classPath>
              <versionInfo>
                  <fileVersion>${project.version}.0</fileVersion>
                  <txtFileVersion>${project.version}.${buildNumber}</txtFileVersion>
                  <fileDescription>WeblocOpener</fileDescription>
                  <copyright>${copyright}</copyright>
                  <productVersion>${project.version}.0</productVersion>
                  <txtProductVersion>${project.version}.0</txtProductVersion>
                  <productName>WeblocOpener</productName>
                  <companyName>Eugene Zrazhevsky</companyName>
                  <internalName>WeblocOpener</internalName>
                  <originalFilename>WeblocOpener.exe</originalFilename>
                  <trademarks>Eugene Zrazhevsky</trademarks>
                  <language>ENGLISH_US</language>
              </versionInfo>
              <jre>
                  <path>%JAVA_HOME%;%PATH%</path>
                  <minVersion>1.8.0</minVersion>
              </jre>
          </configuration>
          <executions>
              <execution>
                  <id>l4j-clui</id>
                  <phase>verify</phase>
                  <goals>
                      <goal>launch4j</goal>
                  </goals>
              </execution>
          </executions>
      </plugin>
      
       
  • Eugene Zrazhevsky

    Hello! Any updates? Any help needed?

     
    • Grzegorz Kowal

      Grzegorz Kowal - 2023-02-28

      Hi Eugene,

      I did not forget, I just could not find the time this week. I will look at
      this problem as soon as I have a moment.

      Best regards,
      Grzegorz

      On Sat, Feb 18, 2023, 10:57 Eugene Zrazhevsky incrediblebd@users.sourceforge.net wrote:

      Hello! Any updates? Any help needed?

      Status: open
      Group: 3.x
      Labels: arguments jni unicode
      Created: Tue Feb 07, 2023 07:20 PM UTC by Eugene Zrazhevsky
      Last Updated: Wed Feb 08, 2023 07:37 PM UTC
      Owner: nobody

      Hello!
      Have found a bug when application is called with unicode symbols in
      arguments.
      Actually they are not supported by java.
      I need to start with a little background to let you understand the main
      trouble:

      Just using java to get calling arguments will modify them and it can
      affect on application working:

      For example: calling application with file argument in path:

      C:\files\İnteraktif Vergi Dairesi.webarchive

      your file path will be transformed to:

      C:\files\Interaktif Vergi Dairesi.webarchive

      as you may notice symbol İ will be replaced to I. So surprise: no file
      would be found on given location.
      Any solutions?

      One of the solutions is to use JNA to use Windows kernel libs to get real
      application arguments. One of examples described here:
      https://stackoverflow.com/questions/70546736/netbeans-chinese-characters-in-java-project-properties-run-arguments
      So what's the point and why I created this issue?

      If I use such kernel solution, I can get actual arguments from kernel and
      everything is fine - file path will be correct:

      C:\files\İnteraktif Vergi Dairesi.webarchive

      But if application jar will be bundled or wrapped by exe launcher - all
      arguments would be replaced by java default arguments processing, so actual
      arguments would be hidden by java:

      C:\files\Interaktif Vergi Dairesi.webarchive

      Jar bundled by launch4j-maven-plugin:2.3.2 via
      net.sf.launch4j.launch4j:3.5.0 under the hood.

      Is there any ideas how to avoid this behavior?
      If you need I can create a simple representing project.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/launch4j/bugs/229/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #229


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.