Author Topic: JRUN - Looking for Guinea pig(s)  (Read 2292 times)

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
JRUN - Looking for Guinea pig(s)
« on: January 11, 2021, 03:12:28 pm »
Hello,

I'd like to ask you for help to test a rather advanced script I've created to aid launch of java applications.
The goal is to make it as easy to install a java app as click on a .jar/.class file.

The script can use OpenJDK 6 and Java 4 in parallel. (See README)

Please do tell me what alterations/adjustments and additions you make to the script as well as faults and problems.

Regards,
//Jan-Erik

Remember: If something goes wrong, it's your fault!

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
« Last Edit: January 13, 2021, 03:31:28 am by Martin Iturbide »

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: Looking for Guinea pig(s)
« Reply #1 on: January 12, 2021, 10:51:00 pm »
Seem like everyone that has downloaded it can make it work... right?

So,what have you tested so far?

Your feedback is greatly appreciated.

Regards,
//Jan-Erik

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 574
  • -Receive: 121
  • Posts: 3171
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Looking for Guinea pig(s)
« Reply #2 on: January 13, 2021, 03:11:53 am »
Hi Jan

Let me know if I understand how it works.
You run JRUN.CMD, it will find your java runtime, put an icon on the desktop, find your .jar file and create a icon on the desktop.

I tried it with "jdiskreport-1.3.1_os2.jar" and it created an icon on my desktop. The icon worked to run the program.

When I download a new .jar file, what should I run to make it scan for .jar file again, for it to create the icon on the desktop?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 574
  • -Receive: 121
  • Posts: 3171
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Looking for Guinea pig(s)
« Reply #3 on: January 13, 2021, 03:20:51 am »
Ohh. I just noticed that the OpenJDK 6 icon created was also associated to .jar files, so that is the way to create the desktop icon.
Regards
« Last Edit: January 13, 2021, 03:23:25 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 51
  • Posts: 1301
  • Karma: +12/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #4 on: January 13, 2021, 01:08:00 pm »
Just one observation.  There should be some way to specify what drives to search - reason, I let it run for several hours while it searched one of my NAS boxes, it never did complete because I killed it before it got to the next NAS box with even larger drives in it.

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: Looking for Guinea pig(s)
« Reply #5 on: January 13, 2021, 06:51:51 pm »
Ohh. I just noticed that the OpenJDK 6 icon created was also associated to .jar files, so that is the way to create the desktop icon.
Regards
Yes, and if you've let it create another program object for Java 4.1/4.2 it will be available on that menu as well.
The main purpose of .jar files should be to run with a java engine.
This is how it look like when .jar has been de associated in the Archive tool.
Notice that it will use the icon and png image with the same name as the .jar file as it create the desktop object

You have to draw and place the icon and/or png image in the folder yourself.
Now may be the time to learn how to draw nice icons and png images.
« Last Edit: January 13, 2021, 08:49:00 pm by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #6 on: January 13, 2021, 07:02:49 pm »
Just one observation.  There should be some way to specify what drives to search - reason, I let it run for several hours while it searched one of my NAS boxes, it never did complete because I killed it before it got to the next NAS box with even larger drives in it.

Interesting... where is it supposed to find and run OpenJDK or Java from, on your machine?
I have both on d: here...

"Advanced 1" in the readme give a hint, but I need to rephrase that instruction perhaps and include when it can't find anything on its own.

copy the files to the bin folder where java.exe reside and run the script there.
If it can't create the program object, then it can't execute "java.exe -version" that should output something like "openjdk version 1.6.0_27" or "java version 1.4.1_07".

This is what it gave me with the script in the java 1.4.1 folder (D:\Programs\Java141\bin) for golden code  java with the proper license file.
Notice that I've also added "Manifest.class" from the same folder as jRun to find out if the script define a main class to run as default.
The order you add an association is important to which one that will become the default and topmost option.
« Last Edit: January 13, 2021, 07:37:49 pm by Jan-Erik Lärka »

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 51
  • Posts: 1301
  • Karma: +12/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #7 on: January 13, 2021, 09:05:49 pm »
Sorry to upset things, java on all my machines resides in the boot partition, OPENJDK6 and OPENJDK6-SDK in the root of drive C: and all the java apps are in JAVA-APPS on drives F: and H:

What you have here reminds me of the set of runjava scripts from 2002.
« Last Edit: January 13, 2021, 09:18:22 pm by ivan »

Joop

  • Hero Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 65
  • Posts: 590
  • Karma: +1/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #8 on: January 14, 2021, 12:34:33 am »
I don't understand this with one program for launching java programs. One thing I know is that we have Java 6, but on some points it is not Java 6, different reactions, it does not work or we need a different memory specification. Lots of programs are very simple in running, but others are very hard and need sometimes lots of settings and options before it will do something. So I opt for using a command file, you can put in what you want and what will work for you. If you know how to start, what options and so on, see my website http://joopn.home.xs4all.nl/os2ecs/ecs6e.htm. There are over 150 programs with where to get it and how to run.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 574
  • -Receive: 121
  • Posts: 3171
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: JRUN - Looking for Guinea pig(s)
« Reply #9 on: January 14, 2021, 02:56:40 am »
I don't understand this with one program for launching java programs. One thing I know is that we have Java 6, but on some points it is not Java 6, different reactions, it does not work or we need a different memory specification. Lots of programs are very simple in running, but others are very hard and need sometimes lots of settings and options before it will do something. So I opt for using a command file, you can put in what you want and what will work for you. If you know how to start, what options and so on, see my website http://joopn.home.xs4all.nl/os2ecs/ecs6e.htm. There are over 150 programs with where to get it and how to run.

Sorry Joop, I did not understand you message. Are you discontinuing your JRUN ? I think it is interesting and my little tests worked fine.  I even made this page on the wiki: https://www.os2world.com/wiki/index.php/JRUN

NOTE: I strikethrought part of this message because I got confused with the usersID... sorry, I think I needed to sleep at that time.

Regards
« Last Edit: January 14, 2021, 02:20:29 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #10 on: January 14, 2021, 09:46:29 am »
Sorry to upset things, java on all my machines resides in the boot partition, OPENJDK6 and OPENJDK6-SDK in the root of drive C: and all the java apps are in JAVA-APPS on drives F: and H:

What you have here reminds me of the set of runjava scripts from 2002.

Yes, they may be similar, but why is there no launcher with ArcaOS?

So you have C:\OPENJDK\bin and C:\OPENJDK-SDK\bin
Important! Java.exe has to be placed in the "bin" subfolder.

Did the script create an icon for it on the desktop or did just not find anything there?

You can test two things if it didn't find anything.
1. Copy the files to the bin-folder with java.exe
or
2. Open a command prompt in the folder with JRun.cmd and type
set rxtrace=on
followed by Enter and then
JRun
and press Enter to step through each line of the script.
« Last Edit: January 14, 2021, 10:40:26 am by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #11 on: January 14, 2021, 10:25:44 am »
I don't understand this with one program for launching java programs. One thing I know is that we have Java 6, but on some points it is not Java 6, different reactions, it does not work or we need a different memory specification. Lots of programs are very simple in running, but others are very hard and need sometimes lots of settings and options before it will do something. So I opt for using a command file, you can put in what you want and what will work for you. If you know how to start, what options and so on, see my website http://joopn.home.xs4all.nl/os2ecs/ecs6e.htm. There are over 150 programs with where to get it and how to run.

Joop, you do a tremendous good job to collect knowledge and insights how to set environment variables etc. to run all these scripts.
This is a script that incorporate your knowledge Joop.
I adjusted it some more from what I sent you (Joop) some days ago.
The script set up environment variables and parameters by adding what can be done to the program object instead of one specific script for each java app.

Look in the program object for a tab to set Environment variables. I found out the other day that it's possible to use SET to add environment variables there... such as PATH, CLASSPATH etc.

Joop, as you may see in the script (I did ask you) and .zip-file, I've instead harvest(.cmd)ed your knowledge as you have and excellent site that present info consistantly. The harvested file cfg.cfg had to be somewhat adjusted, but with only minor adjustments before it was added to the script JRun.cmd. Hmm, reminder, should have removed "!egl", on firefox but forgot that...

Look at the background of the attached images... they contain commented rows that the script itself in the function "adapt" use to read and adjust the settings as it create program objects. Yes, the script read itself! Different java apps use different settings... or not.  You can of course change/adjust the settings yourself once the object has been created to get your specific touch.

The line for JEKS should not start with /*<CLA_ as it does in your scripts, change it to /*JAV_ before you try it.
« Last Edit: January 14, 2021, 04:00:59 pm by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: JRUN - Looking for Guinea pig(s)
« Reply #12 on: January 14, 2021, 11:47:37 am »
This section of code:
Code: [Select]
   PARSE UPPER VALUE rxFind( 'JAVA.EXE', '-version', 'VERSION "1.', here||'\BIN' ) WITH j_path'\BIN¤'type' VERSION "1.'minor'.'rev'_'build'"'
call the function rxFind (look further down the script) that search the computer for java.exe and try to find out which version it report itself as. If java.exe can be found in a sub folder called BIN and return the partial string 'VERSION "1.' with some more text the script use that java version to create the program object.

The name of the program object will be created from the text that fit within the variable "type" above while the version number is taken from "minor" and "rev".

If a java version 1.14.6_04 would be built for OS/2 you'd get a program object called "JAVA 14.6".
If a openjdk version 1.17.3_05 would be built for OS/2 you'd get a program object called "OpenJDK 17.3".

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 574
  • -Receive: 121
  • Posts: 3171
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: JRUN - Looking for Guinea pig(s)
« Reply #13 on: January 14, 2021, 02:22:03 pm »
Hi

I posted a correction to my last post, since I got confused with the users. I strikethrought the text of my mistake.
Sorry for the confusion.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 15
  • Posts: 222
  • Karma: +1/-0
    • View Profile
Re: Looking for Guinea pig(s)
« Reply #14 on: January 14, 2021, 04:19:51 pm »
Hi Jan

Let me know if I understand how it works.
You run JRUN.CMD, it will find your java runtime, put an icon on the desktop, find your .jar file and create a icon on the desktop.

I tried it with "jdiskreport-1.3.1_os2.jar" and it created an icon on my desktop. The icon worked to run the program.

When I download a new .jar file, what should I run to make it scan for .jar file again, for it to create the icon on the desktop?

Regards

Yes!
JRun create the program object that allow you to create program objects for each .jar and .class file. I know that it is somewhat confusing that one script act as a double for itself instead of require more scripts.

After you run it once it associate itself as you have shown and you can create program objects for a .jar file with a double click. Use the program objects to start that "app".

Even other applications (native OS/2, java etc.) may be registered to handle the same file format, so more applications may appear in the list.
You can also add associations by hand, for a program object if you like.

The first application in the list act as the default application that will launch as you double click on the file. Files that use the extension show up with the application icon so you know what application will start for that file by default.
« Last Edit: January 14, 2021, 04:38:34 pm by Jan-Erik Lärka »