OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Setup & Installation => Topic started by: Jan-Erik Lärka on January 11, 2021, 03:12:28 pm

Title: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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.
Title: Re: Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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
Title: Re: Looking for Guinea pig(s)
Post by: Martin Iturbide 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
Title: Re: Looking for Guinea pig(s)
Post by: Martin Iturbide 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
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: ivan 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.
Title: Re: Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: ivan 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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Joop 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 (http://joopn.home.xs4all.nl/os2ecs/ecs6e.htm). There are over 150 programs with where to get it and how to run.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Martin Iturbide 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 (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 (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
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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 (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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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".
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Martin Iturbide 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
Title: Re: Looking for Guinea pig(s)
Post by: Jan-Erik Lärka 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.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: David Graser on January 15, 2021, 01:54:26 am
Now that I understand how it works, I can say that it works great . 

Tested on Dominion and ImageEditor.  I drag from FM/2 to your created Java 6 icon.  No problems so far.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 18, 2021, 08:21:30 pm
'Here's an update...

1. Assume that Ivan for example didn't have any NetRexxC.jar on his computer, but several drives... the adjustment doesn't look that deep for netrexx.*

2. The NetRexxKing.png image has been adjusted so that the face isn't transparent.

3. harvest.cmd of Joop's site didn't look at classpath .jar files to decide the name of object id... that pasted section created by harvest.cmd in the JRun.cmd script has been updated.

*OBS!!!!
Updated the script once more as the adjustment for netrexx caused side effects!
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 24, 2021, 04:23:40 pm
Here's the most recent update...

Had to redesign parts of the script to handle the unexpected behaviour the program object environment page offer.

The code to not search for NetRexx didn't search enough, so it had to be adjusted again.

Introduced ^ to escape ; in the setupstring (also harvest.cmd)

This time you can look at the web page (http://www.xn--lrka-loa.com), read about JRun (http://www.xn--lrka-loa.com/JRun.html) and and download it.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Neil Waldhauer on January 25, 2021, 04:05:15 am
The web page you gave above is not responding.

I'm interested in getting NetRexx running. I try NetRexxC.cmd, but it gives errors.

Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time
Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time

Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Joop on January 25, 2021, 09:24:43 pm
'Here's an update...
3. harvest.cmd of Joop's site didn't look at classpath .jar files to decide the name of object id... that pasted section created by harvest.cmd in the JRun.cmd script has been updated.
???? Where did you find "harvest" on my site? All Java programs on my site are tested with the given cmd file, the only thing I do is making the drive and directory more standard, but that doesn't influence the working. So everyone who want to make use of the cmd file only have to re edit the drive and path names. That's clearly lined out, that is, no one complained yet ;-)
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 27, 2021, 07:19:02 am
The web page you gave above is not responding.

had a power outage in the area... but ok, I'll post the package here.

1. NetRexx 3.04 can be used with OpenJDK 6, later versions of NetRex seem to use a feature only present in newer versions of java.
2. The script included with NetRexx has not been updated for long... so you have to rewrite it completely or use jRun instead. There's No point in using NetRexxc.cmd. The program object it create associate itself with .nrx files so you can Compile / Run them with a click
3. Download java2nrx and add a program object for it (with JRun) you can convert .java code to .nrx code

I'm interested in getting NetRexx running. I try NetRexxC.cmd, but it gives errors.

Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time
Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time

The documentation for java state that you may only run the server or client version of jvm.dll at a time.
The text above say that the script try to start the client version.
What other java app may be running at that time?
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 27, 2021, 09:13:08 am
???? Where did you find "harvest" on my site?

I wrote harvest.cmd, to do the harvesting of information from your site that can be downloaded with
wget http://joopn... and some additional parameters.

 
All Java programs on my site are tested with the given cmd file, the only thing I do is making the drive and directory more standard, but that doesn't influence the working. So everyone who want to make use of the cmd file only have to re edit the drive and path names. That's clearly lined out, that is, no one complained yet ;-)

the cmd file for each application that each has to be adjusted statically when there is rexx and all joops knowledge how to dynamically set both general and common settings to run each app.
Code: [Select]
<PRE>
@echo off
SET BEGINLIBPATH=[drive: java]\JAVA160ga5\bin
SET path=[drive: java]\JAVA160ga5\bin
[drive: fatcalc]
cd [drive: fatcalc]\fatcalc
java -Duser.home=[drive: fatcalc]\fatcalc -jar fatcalc.jar 2&gt;fatcalc-bugs.txt
</PRE>

harvest.cmd read each htm file and look for the tag '<PRE>' to '</PRE>'
'[drive: java]\JAVA160ga5\bin' is the openjdk directory that the script already know where it is, reuse that knowledge.
[drive: fatcalc]\fatcalc is the directory to start within, the script get that directory from the parameter as one click on the .jar file the first time to add a program object for it as working directory.
etc. etc.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 27, 2021, 09:21:05 am
Here is the latest adjustments to jrun that you also can get from the homepage.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Neil Waldhauer on January 27, 2021, 06:19:12 pm
The web page you gave above is not responding.

had a power outage in the area... but ok, I'll post the package here.

1. NetRexx 3.04 can be used with OpenJDK 6, later versions of NetRex seem to use a feature only present in newer versions of java.
2. The script included with NetRexx has not been updated for long... so you have to rewrite it completely or use jRun instead. There's No point in using NetRexxc.cmd. The program object it create associate itself with .nrx files so you can Compile / Run them with a click
3. Download java2nrx and add a program object for it (with JRun) you can convert .java code to .nrx code

I'm interested in getting NetRexx running. I try NetRexxC.cmd, but it gives errors.

Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time
Error: K:\PROGRAMS\JAVA600\JRE\bin\client\jvm.dll: this JVM conflicts with a dif
ferent type of JVM loaded by another process. You may only use one JVM type of a
 given Java installation at a time

The documentation for java state that you may only run the server or client version of jvm.dll at a time.
The text above say that the script try to start the client version.
What other java app may be running at that time?

Thanks for your help.

To start, I just wanted to run hello.nrx

I'm running on the Q: drive. My SDK is in Q:\Programs\java600. I am running Jetty with JavaMail, so maybe that's why it is running server.

NetRexx is in Q:\Programs\NetRexx
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on January 30, 2021, 12:52:08 pm

Thanks for your help.

To start, I just wanted to run hello.nrx

I'm running on the Q: drive. My SDK is in Q:\Programs\java600. I am running Jetty with JavaMail, so maybe that's why it is running server.

NetRexx is in Q:\Programs\NetRexx

Had to adjust the script again to handle NetRexx.
Replace JRun.cmd and now it should behave.

Tested Java/OpenJDK to load the server version of jvm.dll with JDownloader (version 2 ) and Genealogy.
"-server" on the command line is possible to use with JDownloader, but it launch itself after updates and restart and then complain. See the attached image of what it may look like then.

Add -server to the parameters of the program object to run the application in server mode.

The script (JRun.cmd) can't run a plain client java version if that same java engine already has been started with the parameter "-server". JRun.cmd then automatically try to find another java/openjdk version to use. I have Java 4.1 that it detect and create a program object for and try to run...

What is your opinion on that? Should it stop and do nothing or try to find another one to use?

Some of you may have opened the script in a text editor and looked at the code already.
If so, you'll notice that there are environment variables you can set to make it behave differently.
Please do try them out as well.
Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Neil Waldhauer on January 30, 2021, 03:16:39 pm
I had asked to run NetRexx, and you helpfully explained that it had to be version 3.04.

The NetRexxC.cmd included did not work well, and gave an error message similar to the -server message you posted. So did JRun.cmd. Looking inside JRun.cmd shows that it was very similar to NetRexxC.cmd.

One problem was that it found the Java compiler on the wrong drive. I found the rxFind was causing this problem.

The -server error message also occurs if the wrong drive is used in -client mode. I was using a server program, but I did not invoke with -server. Maybe I should.

But I wanted to run NetRexx, and JRun wasn't helping enough, so I made a simpler script that just runs NetRexx. Now I can run simple NetRexx programs. I cannot run all the examples, but I expect I now need to find the NetRexx docs to see what else is needed. NetRexx was a clever idea, but it seems just as inconvenient as running Java as far as creating the right classpath with all the needed components.

Title: Re: JRUN - Looking for Guinea pig(s)
Post by: Jan-Erik Lärka on February 04, 2021, 07:46:40 pm
I had asked to run NetRexx, and you helpfully explained that it had to be version 3.04.

The NetRexxC.cmd included did not work well, and gave an error message similar to the -server message you posted. So did JRun.cmd. Looking inside JRun.cmd shows that it was very similar to NetRexxC.cmd.
Yes.
And the updated JRun tries to find another java version as it's not possible to run the same java.exe (at all) with a different setting for server/client. All other instances has to use the same parameter if one instance of java.exe has been started with -server
One problem was that it found the Java compiler on the wrong drive. I found the rxFind was causing this problem.
You can force which one it should use by setting the environment string such as
j_path=C:\java160
but it will yet try to use another if that java version is blocke, if the script for example find a version in C:\Programs\Java141 that return a valid version string.
The -server error message also occurs if the wrong drive is used in -client mode. I was using a server program, but I did not invoke with -server. Maybe I should.
avoid mixing "-server" as it seem to cause problems.

Remove program objects that was created with jrun that show such messages, or set the environment variable as mentioned above. Remove a misbehaving program object and let the new version recreate it to fix faults you saw from the previous version of the script.

But I wanted to run NetRexx, and JRun wasn't helping enough, so I made a simpler script that just runs NetRexx. Now I can run simple NetRexx programs. I cannot run all the examples, but I expect I now need to find the NetRexx docs to see what else is needed. NetRexx was a clever idea, but it seems just as inconvenient as running Java as far as creating the right classpath with all the needed components.
The latest version I posted does exactly what your script does... and more, as it allow you to specify if you just want to compile and/or also run the compiled script.

Several of the included examples does however not even work on other platforms as the IBM examples has been moved into renamed sub-folders or something like that.