Marathon ITE , Java swing Applet , is it a must to have a local copy of the applet? - applet

I'm new to marathon , just started with a simple swing based applet automation . In the configuration,we specify the local path of the html page containing the applet .
Is it possible to automate in marathon without specifying the local path of the HTML page ???
Why because , say my application is hosted on some server , in which case access to the source code of the application and applet will not be there .
Is there any alternate ????

MarathonITE internally uses appletviewer to launch the application. It is not needed to use local copy. In that case, use command line launcher and provide a script file that launches appletviewer with appropriate arguments.

Related

Angular module federation: Webcomponents and assets static file sharing between MFE and Shell application in polyrepo scenario

Currently i am facing two problems:
I have two repos one for shell and another for MFE application
Here is the version o module federation
#angular-architects/module-federation": "^14.3.12
First Problem:
I have webcomponent created which is custom grid and it created separately in different repo. And this components is install via npm (added in package.json file) in MFE application project. And add the necessary files in script section of angular.json file. MFE application run properly when standalone. But when we use the MFE in shell application the shell application doesn't show the custom webcomponent. Only way to work is to install the same webcomponent in shell as well to work.
So anybody any idea how can share the webcomponents which used by MFE in shell application instead of installing in shell application project?
Second Problem:
Another problem I currently facing is sharing static files between MFE application and shell.
I have env.js file which has api call urls which is used by MFE application.With MFE application its works correctly.
But when I load the MFE application in shell application it doesn't recognizes the API url call because it tries to search in its asset folder instead of assets folder of MFE application?
Please let me know what i am missing here?
I tried with webconfig.js files in MFE application which angular module federation has created but didn't got any break through to these problems

To apply digital signature on pdf using applets

Im trying to implement digital signature on pdf using java applets. I have passed the required jars to the applet
<applet
width="1300"
height="900"
code="HelloWorld.class"
archive="bcpkix-jdk15on-1.47.jar,bcprov-ext-jdk15on-1.47.jar,itextpdf-5.3.5.jar">
</applet>
but failed to run on browser even though it works on applet viewer. When I add these jars in the /jre/lib/ext folder then it runs on the browser as well.
I can't place the jars on the specified folder as the applet runs on client's browser and wont be a good solution to place the jars on the pc of every client.
You cannot just add security providers without permission. You need to sign your code and have the user accept the applet to make changes to do that.

How to setup a project to run using JNLP?

I currently have an application that runs from the desktop, but I would like to make it deployable from web browsers using JNLP. How do you go about setting up jnlp for an application? Are there any examples that go more in depth then a hello world?
So I ended up following this reference http://www.oracle.com/technetwork/articles/javase/jnlp-142088.html to build my jnlp. On a side note to add more jars etc all you need to do is list more jar tags and tag one as main. Use this to reference the structure and required tages https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlpFileSyntax.html#extension

Best way to set environment variables in NetBeans Platform App

I would like to set some environment variables for a NetBeans Platform app. Is there a clean way of doing this so the environment variables are set when I start the app without having to write a custom startup script? I'm doing this on a linux environment.
https://netbeans.org/features/platform/
If you want to pass arguments/commandline parameters to the NetBeans Platform app during startup, you can pass those parameters either directly to the launcher or via the etc/<brandingname>.conf file which is located in the distribution of the application. There you can determine any options via the default_options attribute. Example-
default_userdir="${HOME}/.${APPNAME}/user"
default_cachedir="${HOME}/.${APPNAME}/cache"
default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-ea --branding mybrandingcluster"
jdkhome="jre"
Furthermore, you can separately assign the path of the Java
Platform, the user directory, and additional clusters in this file.
If you are looking forward to save environment variables specific to your application you can use the NbPreferences API. Detailed example is listed in GeertjanĀ“s blog

How to distribute my Java program so that it is runnable by double-clicking a single file?

I have a Java rich client desktop app. that I want to distribute on some computers at work, but I've never done something like this before. People aren't too computer-savy at my workplace and since it is a student job, I won't be there for much longer and I'd like it if I could make my program easy to run by making it runnable when people double-click on it.
I also don't want to have to manually install a JRE to have it run. Basically, what I'd like to know is how to make my java application runnable easily by double-clicking (even if it's only on windows, it's okay). I'm pretty sure I'm going to need to package the correct JRE version alongside, but I don't know what's the correct way of doing this.
I read on some sites that you should not package a JRE along with your program because it makes people have multiple different versions, some of which are outdated, and it causes security issues, but this is not a problem in this case since the computers that are going to run my application are not connected to the internet and are only used to run this program anyway.
Somewhat related question: Since my application is currently an Eclipse project, I get my resources such as icons, images, SQLite database (for read and write), etc. using relative paths (e.g.: img/test.png).
Am I going to have to change any of those paths to have them keep working even while packaged?
What you're looking for is a JAR file. In eclipse, it's quite easy to make a Jar file. Specifically, you'll want to right click on your project, go to Export, and then select "Runnable Jar." Be careful with paths to folders. You may need to keep a resources folder next to the Jar file. You may need to provide some more specifics to get an exact answer on that. Typically, a Resources folder is located in the same spot as the JAR file (in the same folder on your computer).
A better option for easy install of a Java app. with a GUI is to launch it using Java Web Start. For the user, JWS is the 'one click' installation option that can (install & launch the app. then) add desktop shortcuts and menu items. A JWS launch would mean some more work for you, but it is a breeze for the end user.
To ensure a suitable JRE is present to run the app., use deployJava.js (see the JWS link for more details). The script would need to be reconfigured to get the JRE installer from your local network - the default is to get it from Oracle.
Most of the resources should be packaged in Jar files and supplied along with the app., but for the DB, use the JNLP ExtensionInstallerService to call the DB installer.
..Java Web Start is kind of a link (or I can make it a shortcut on the desktop) that the users will click to either install the JRE and run the program if the JRE isn't installed, or just run the program if the JRE is present on the computer.
The way it would work is to have a web page on the local intranet. When the user visits the page, the script checks for a suitable JRE.
If it is present, it writes the link to the launch file.
If there is no JRE, or the version is too low, it will guide the user through installing it (just a matter of them clicking 'OK' when prompted). Then it will put the link to the app.
I can then configure the link to grab the JRE from the server on our network.
That's the part where you need to reconfigure the script. AFAIR the script exposes an URL at which to look for JREs - that can be changed to point to a place on the intranet.
..So "Web" is only just in the name, the computers don't have to be connected to the internet to have this work, right?
Yes. JWS is a great launch technology for Java rich clients, but is a poorly chosen name.
To make the problem run by double clicking it you can distribute it as a jar file or a batch file to call the jar file.
For the installation part you can make a batch file that checks if java is present and then call the installer if it isn't.
Edit:
The batch code:
IF DEFINED JAVA GOTO ok
java-installer.exe
GOTO end
:ok
your-application.jar
:end
If you are finding it tough to implement the above mentioned methods. You can proceed with this simple approach.
Create a folder lib at a location. Place all the jars that your application uses into this. If you are able to create a jar for your application, you can very well place your application.jar into the lib folder too. Create a batch file at the same location that will contain the java command for your main class in it. The text within your batch might look something similiar to this :
set path="\lib\"
java -cp %path% package1.package2.MainClass
If you have any other dependencies, for ex: if you use images in your code under img/icon.jpg. Then you just have to shift the img folder to this location too.
Just zip these files using winrar and share it across. Running the batch file after extracting the zip would launch your java MainClass irrespective of the location in which it is placed in the client system.
PS : If you are unable to create a jar for your application and placing it in lib folder, just copy your bin folder with class files and paste it in the location and change the batch file accordingly to look for classes inside bin.