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.
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.
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.
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?
default one to have highest compatibility with Johns plans (his preferred way):
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.
Johns opinion would be highly appreciated.
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:
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?
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
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.
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.
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.
JAVA:
environmental variables:
GTK:
environmental variables:
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?