You are here

[Portable Application Template] - Suggestion - JRE/GTK guidelines

12 posts / 0 new
Last post
bgillis
bgillis's picture
Offline
Last seen: 3 years 9 months ago
Joined: 2007-05-11 04:25
[Portable Application Template] - Suggestion - JRE/GTK guidelines

What is it for ?
The purpose of this discussion is to define guidelines for using JRE/GTK within the Portable Application Template as definied by Karl Loncarek here.

History
The original discussion starts here and here.

What are the first available guidelines ?

Directory structure

+-\ Portable.exe
  +-\App\
  | +-\<NAME>\ Sources\ (optional)
    +-\<NAME>PortableSources\ (optional) .exe
  +-\<NAME>Portable\
    +-\App\
    | +-\<NAME>\ Sources\ (optional)
      +-\<NAME>PortableSources\ (optional) .exe
  +-\PortableApps\
    +-\<NAME>Portable\
      +-\App\
      | +-\<NAME>\ Sources\ (optional)
        +-\<NAME>PortableSources\ (optional) .exe
  +-\Apps\
  | +-\<NAME>Portable\
  |   +-\<NAME>\ Portable\
  |   +-\Registry\ (optional, will be created automatically when needed)
  |   +-\Settings\ (optional, will be created automatically when needed)
  |   +-\RegistryBackup\ Portable\
      +-\<NAME>Sources\ (optional)
      +-\<NAME>PortableSources\ (optional) 
+-\ Portable.exe
  +-\CommonFiles\
  | +-\JRE\
  | | +-\<JRE_VERSION>\ Sources\ (optional)
    +-\<NAME>PortableSources\ (optional) .exe
  +-\CommonFiles\
  | +-\JRE\
  | | +-\<JRE_VERSION>\ Portable\
    +-\App\
    | +-\<NAME>\ Sources\ (optional)
      +-\<NAME>PortableSources\ (optional) .exe
  +-\PortableApps\
    +-\CommonFiles\
    | +-\JRE\
    | | +-\<JRE_VERSION>\ Portable\
      +-\App\
      | +-\<NAME>\ Sources\ (optional)
        +-\<NAME>PortableSources\ (optional) .exe
  +-\CommonFiles\
  | +-\JRE\
  | | +-\<JRE_VERSION>\ Portable\
  |   +-\<NAME>\ Portable\
  |   +-\Registry\ (optional, will be created automatically when needed)
  |   +-\Settings\ (optional, will be created automatically when needed)
  |   +-\RegistryBackup\ Portable\
      +-\<NAME>Sources\ (optional)
      +-\<NAME>PortableSources\ (optional) 
Automatic detection
Configuration file
JRE
jreportable.ini.

[JREPortable]
Vendor=Sun Microsystems Inc.
Version=<JRE_VERSION>
URL=http://java.sun.com/

This file is only needed if the portable application doesn't include a proper JRE. Then the JRE to use by the application must be located in a directory with the following structure (further details available here):

  +-\CommonFiles\
  | +-\JRE\
  | | +-\<JRE_VERSION>\

The INI file must be located in the directory JRE of the application (further details available here)

<JRE_VERSION> must be replaced by the appropriate version number (eg. 1.5.0_01).

GTK
gtkportable.ini.

[GTKPortable]
Version=<GTK_VERSION>

This file is only needed if the portable application doesn't include a proper GTK. Then the GTK to use by the application must be located in a directory with the following structure (further details available here):

  +-\CommonFiles\
  | +-\GTK\
  | | +-\<GTK_VERSION>\

The INI file must be located in the directory GTK of the application (further details available here)

<GTK_VERSION> must be replaced by the appropriate version number (eg. 2.0).

Environment variable setup
JRE
JAVA_HOME setup to the location of the valid JRE located.

+-\PortableApps\CommonFiles\JRE\1.5.0_11

The path %JAVA_HOME%\bin must be also added to the environment variable PATH (to make executable java.exe and javaw.exe available on the command line).

GTK
GTK_BASEPATH setup to the location of the valid GTK located.

+-\PortableApps\CommonFiles\GTK\2.0

The path %GTK_BASEPATH%\bin must be also added to the environment variable PATH.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
Thanks for moving the discussion about that here.

With win2k I installed both and don't see any environment settings (using SET in the command line)

Are the above GTK_BASEPATH and JAVA_HOME necessary in order for GTK/JAVA to work?
Is it sufficient for apps that use GTK/JAVA to simply set those environment variables?
We know already that OO needs a special change in an XML file. What about other applications?

What would have to be copied into a common GTK or JAVA folder? Is it necessary to adapt some files to the new maybe drive letter?

Another Thing: What about common Python? OO uses it, Inkscape could use it?? OK lets handle GTK/JAVA first.

It would be very nice if others could pointout their opinion too.

JAVA:
Copying everything within e.g. "C:\Program Files\Java\jre1.6.0_01" (at list the bin and lib folder) is sufficient. It seems like no need for any changes in any java configuration files.

GTK:
Copying everything within e.g. "C:\Program Files\Common Files\GTK\2.0" According to Portable GIMP it is only necessary to set the environment variables accordingly. At least this is what is done there.

bgillis
bgillis's picture
Offline
Last seen: 3 years 9 months ago
Joined: 2007-05-11 04:25
well... it's not so simple.

You can of course use a GTK or a JRE independantly without defining any of these variables.

GTK_BASEPATH and JAVA_HOME are not necessary at all. There are just standard environment variables used by most application that need a JRE or GTK to start.

If these variables exist, most application will use it to locate the JRE or GTK to use to start the application. If they don't exist, the application will try to lookup a JRE or a GTK installed locally using:
- JRE or GTK directory in the directory structure of the application (looking of java.exe or javaw.exe),
- configuration files - eg. INI file,
- registry settings,
- hardcoded path within batch file,
- ...

What I propose to standardize is the setting of both GTK_BASEPATH and JAVA_HOME environment variables and the additional PATH variable based on the 2 first lookup methods above. For the other lookup techniques, I think it will always need specific customizations of the NSIS script depending on the application.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
Ah I see.

setting the environmental variables is not a problem at all. If this is everything that has to be done.

Does anyone know of something additional that is necessary?

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
One directory structure should be added as

default one to have highest compatibility with Johns plans (his preferred way):

  +-\PortableApps\
    +-\CommonFiles\
    | +-\JRE\
    | | +-\<JRE_VERSION>\ \ Portable\ \ Sources\ (optional)
        +-\<NAME>PortableSources\ (optional) 
similar to your 7th version, just the portable.exe is located somewhere else.

Also CommonFiles\Java\ should be supported for compatibility reasons to Johns launchers.

And yes you're right local JRE or GTK installations should be supported also. The question is simply  wouldn't it be easier to reduce the possible combinations.

Cuurently above there are 4 variants with included JRE/GTK and 4 with CommonFiles plus an additional one shown here.

But I still don't understand what the jreportable.ini and the gtkportable.ini is needed for. If those are local installations I would assume that the correct version was included so checking is not really necessary.

Because I think defining a JRE/GTK version umber within the nsi source would be sufficient. Just doing a check: when there is no local JRE/GTK than use the general one found in CommonFiles that has the same version number (in the directory name) If this one isn't also found simply use the JAVA directory as source.

What do you think about that?
bgillis
bgillis's picture
Offline
Last seen: 3 years 9 months ago
Joined: 2007-05-11 04:25
You're right.

There are many combinations... but I've simply restarted from the structures described in your Portable Application Template v1.9.4.

gtkportable.ini and jreportable.ini are not needed for 1st, 2nd, 3rd and 4th version. That's exactly what I mean when I'm talking about "This file is only needed if the portable application doesn't include a proper JRE or GTK".

But for the other versions, you must provide to the launcher the JRE/GTK version to use because several JRE/GTK could co-exist within the directory CommonFiles. Of course, you could hardcode the proper version in the NSIS script of the launcher but then, you loose flexibility. That's the reason why I propose to use a special configuration file for that purpose... that can be extended when needed (eg. JVM additional parameters - Xms, Xmx, ...).

You could also reuse the current configuration file <NAME>Portable.ini for the same purpose but you then introduce loose coupling between different parameters. I think John introduce that additional javaportable.ini file for the same reason instead of reusing <NAME>Portable.ini.

"JRE" is more appropriate than "Java" because we are talking about a Java Runtime Environment (aka JRE). As far as I know, JDK (aka Java Development Kit) are not portable at all. "JRE" is then more specific and closer to "GTK" terminology (aka GIMP Tool Kit). That terminology is not really a big issue because "Java" and "JRE" directory name could be checked independantly but standardization is always better.

I'd really like to have John's opinion on all that.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
Yes

Johns opinion would be highly appreciated.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
Do you agree with the following or

do you think there is some better solution:
First I will remove one possible directory structure as it does not really make sense. (The last one)

Then the following possibilities and explanations will be valid:

+-\CommonFiles\ (optional)
| +-\GTK\
| | +-\<GTK_VERSION>\ (optional, files/directories of GTK installation (bin, lib, ...)
| +-\JAVA\
|   +-\<JRE_VERSION>\ (optional, files/directories of JRE installation (bin, lib, ...)
+-\ Portable.exe
  +-\App\
  | +-\<NAME>\ Sources\ (optional)
    +-\<NAME>PortableSources\ (optional) .exe
  +-\CommonFiles\ (optional)
  | +-\GTK\
  | | +-\<GTK_VERSION>\ (optional, files/directories of GTK installation (bin, lib, ...)
  | +-\JAVA\
  |   +-\<JRE_VERSION>\ (optional, files/directories of JRE installation (bin, lib, ...)
  +-\<NAME>Portable\
    +-\App\
    | +-\<NAME>\ Sources\ (optional)
      +-\<NAME>PortableSources\ (optional) .exe
  +-\PortableApps\
    +-\CommonFiles\ (optional)
    | +-\GTK\
    | | +-\<GTK_VERSION>\ (optional, files/directories of GTK installation (bin, lib, ...)
    | +-\JAVA\
    |   +-\<JRE_VERSION>\ (optional, files/directories of JRE installation (bin, lib, ...)
    +-\<NAME>Portable\
      +-\App\
      | +-\<NAME>\ Sources\ (optional)
        +-\<NAME>PortableSources\ (optional) " or "CommonFiles\GTK\"
C. "CommonFiles\JAVA" or "CommonFiles\GTK"
D. on the host computer installed JAVA or GTK

Remarks: When the above A and B do not exist C will be used regardless of the
installed version. It is highly recommended to use B as far as possible if you
want to share it with other portable applications. If your application does not
require a special GTK/JAVA version it is recommended to use C with the newest
available version of GTK/JAVA. <JRE_VERSION> should be only the version number
e.g. "1.6.0_01", otherwise it won't be found. A message will appear when the
hosts JAVA/GTK will be used.

I would ignore any jreportable.ini or gtkportable.ini as it is not really needed for the template itself. It might be needed for some applications that use the CommonFiles structure. Therefore I would recommend creating them (when there is some "standard" on how they have to look like)

What do you think about that? Does anyone else have an opinion?

bgillis
bgillis's picture
Offline
Last seen: 3 years 9 months ago
Joined: 2007-05-11 04:25
It seems really good to me.

It's definitively an excellent simplification.

I'd really like to have John's opinion about this. I think PAT must share John's rules for directory structure of GTK and JRE locations as well as version detection... or better, give him additional rules to update or even extend his own model.

John introduced the concept of javaportable.ini (jreportable.ini more appropriate in my opinion - see below). It would be great to talk to him about the concept hidden behind this file and how it can be extended and used in PAT for JRE version customization.

I insist that "JRE" is more appropriate than "JAVA" because the content of "JAVA" directory will be always one or more JRE... and never a JDK (not portable). "JAVA" is too vague. A JDK or a JRE installed locally are always located under a directory named "JRE*" or "JDK*"... and never "JAVA"... using standards is always better Wink

It's weird that nobody seems to share his/her opinion on this topic. A lot of java applications are available and could benefit of this addition to PAT.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
I agree JRE would be more precise

But I used JAVA as this was used by John with OO portable and thus is for me kind of a standard.

Therefore we need more opinions to agree on that. Integration into PAT is not a problem.

I really would like to hear other opinions on that. I don't want to invest work and no one wants or needs or uses it.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
Strange

it seems like nobody is interested in that extension of the template?!
OK then I'll implement it in the last suggested way. Release will be available in a few days.

Klonk
Offline
Last seen: 12 years 2 weeks ago
Joined: 2006-04-21 03:08
So what has to be set in order for it to work?

JAVA:

environmental variables:

JAVA_HOME
add "%JAVA_HOME%\bin" to PATH

GTK:

environmental variables:

GTK_BASEPATH
GTKMM_BASEPATH
GTK_HOME
GTKMM_HOME
add "%GTK_BASEPATH%\bin" to PATH

If no default directory structure is found than no environmental variables are set, right?

Did I miss anything important?
Is it necessary to save the path together with parenthesis? I guess yes as the path might contain spaces.

Comments?

Log in or register to post comments