Mac Os Catalina prevents jar app to folder - java

I have a .app on mac that launches a jar via a sh script. This means that the app itself is just lunching a jar then the app is no longer running as the jar starts.
The Jar requires access to the launching users Desktop, but in Catalina due to new security restrictions the desktop is blocked. Anyway to trigger in java a mac alert that allows the user to grant access? This is the best approach due to if you go to privacy and whitelist to full folder access the user can only add the app, not the jar/java jre which is what i believe the issue is.

So i was able to figure it out. My app launcher was a sh script that ran an exec java ... so basically bc i wanted to use my included framework i launched from java bin folder in the .app using an exec command in a shell script that.
I changed to just running the command line and setting the icon without exec, so in essence java launched like it would have if i executed out of terminal . By doing thus catalina recognized the folder access and prompted for access properly.

Related

How to allow JAVA Web Start application to access file system on macOS Catalina if it is started by double clicking on JNLP file?

With macOS Catalina we are experiencing the following problem: opening Java Web Start applications behaves differently when application starts by double clicking on JNLP file and when it is started by double clicking on a shortcut installed on a desktop.
In the first case (double click on a downloaded JNLP file) application opens without permissions to access file system - trying to get the directory listing in user's Desktop directory in JAVA code always returns null. There are no prompts presented to the user asking for any permissions to access the file system. This is not an expected behaviour.
In the second case (starting it from desktop shortcut) user is first prompted that application is trying to access the file system and asked for a permission. When user allows application to access files - application reads user's Desktop directory properly. This is the expected behaviour.
Is there a workaround for this? How can we make web start application access file system on Catalina if it is started by double clicking on JNLP file (which is how the application must be started at least for the first time)?
I've run into a similar problem running a legacy .jnlp app. I was able to get around it by simply invoking the application from CLI (iTerm/Terminal/etc.) :
# javaws filename.jnlp
The root cause is that macOS 10.15 (Catalina) now requires non-Apple applications to be specifically granted "Full Disk Access" permission. Check out this and this for details. Using the explanation there, I added /usr/bin/javaws (and other java binaries such as java and appletviewer) to "Full Disk Access", but that didn't resolve the issue.
Based on an older thread, it seems that if the path to the application is not under /Applications/ (in this case, java and javaws are under /System/ and not under /Applications/), then Full Disk Access is not honored. So it's very likely that a fix needs to be provided by Apple to allow running these applications from the UI.
We were able to resolve this by granting Full Disk Access to /System/Library/CoreServices/Java Web Start.app
For me the problem was solved by installing a different version of Java.
I had the same issue on OSX Catalina 10.15.7. I was able to launch the jnlp file by first setting JAVA_HOME.
export JAVA_HOME=$(/usr/libexec/java_home)
javaws /path/to/file.jnlp

JAR is executed with terminal but not with direct clicking

I have tried the following:
in terminal it works
In Intellij it works
I have tried to launch it with javaw.exe but nothing changes
Are there any other options?
This looks like an OS problem that an application building one -- because you said that it works in your IDE and terminal.
Make sure that you installed Java properly in your machine.
In Windows/MacOs, after installing Java, the *.jar files are automatically associated with the java -jar command and makes it runnable via double-click.
In linux, this varies on the flavour or DE you are using. But there's probably a utility in your OS to open *.jar files using java -jar command.

auto-start java app at windows 8.1 login

I have a java app that I want to auto-start at user login on a clients Windows 8.1 box.
I have created an executable jar on my Windows 8.1 box.
I have converted the jar to a Windows executable via Launch4j.
I have generated a Windows setup executable containing the app and a jre via Inno Setup Script.
I have downloaded the setup executable to the client Windows 8.1 box.
I have run the setup executable on the client box.
In the install directory on the client machine, I have run a powershell ps1 file
that successfully creates a shortcut (a .lnk file) to my app in the Windows 8.1 directory structure at:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\mycompanyname
The contents of my powershell ps1 file are:
powershell Set-ExecutionPolicy RemoteSigned
$TargetFile = "C:\Program Files (x86)\mycompanyname\myexecutablename.exe"
$ShortcutFile = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\mycompanyname\mylinkname.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
"$TargetFile -NoLog -NoExit"
My reason for running powershell is to create the shortcut link to my app programmatically, rather than have my client user wade through a large number of Windows UI pages.
When I right click on the shortcut and run it as administrator, my app icon appears in the SystemTray as expected. I can right click on the icon and select my various options, and all works well.
However, when I log out, and then log back in, my app icon does not appear in the SystemTray.
How do I get my app icon to appear in the SystemTray after I log out and then log back in?
At this time I am guessing that my powershell ps1 needs to not only create and save my shortcut, but also to set things up such that the app auto-starts at user login.
The end goal is to have my app icon appear in the SystemTray after a user logs in to the Windows 8.1 box, much in the same manner that the app icons for WebRoot, Norton Security Suite, etc., do.
Help, please.
I would use the Registry and the Run key.
More details seen here
Sample.reg shown below.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"MyApplication"="C:\\Program Files\\MyApplication\\1234567.exe"

Check "Run as Administrator" of shortcut file (.lnk) via vb script in windows

Running .bat file in Windows 2008 as admin.
I have Java Application installed in Windows 2008 as user (Name of user is Test. Group of user is Admin). This application is using JSW and generating .bat file for starting application in Windows platform. This .bat file are created with help of maven plugins.
Now the problem is if I click on .bat file as normal windows user with default security settings then it does not start my application. If I start .bat file as "Run as Admin" then application starts. If I change security setting of 'Test' user and make is liberal then I can start application without running 'Run as Admin'.
I want to automate this step. I don't want user to do 'Run as Admin' or change their security settings. So I came up with solution that run some vb script after installing application by installer so that file make some security settings of that .bat file so 'Test' user can start .bat file in one step. Is this possible or any better solution ?
By the way I am using Install Anywhere for installer.
After trying for some time I figured out that I can also change setting (Advance Properties) of shortcut file which point to .bat file. This Shortcut have advance properties where there is option "Run as Administrator". If that option is checked then my issues is solved. So I was wondering is it possible to check that option in from vb script? If yes then any hints? and if not then what are alternation to do that?
I found http://nsis.sourceforge.net/ShellLink_plug-in but I do not how to do that in vb script.
I don't think it's possible to do that in a batch file without prompting for password. You could make a small c++ launcher to request privileges and then run your java application.
what version of JSW are you using?
Starting with version 3.5.7 of the JSW, it will automatically request an elevation to Administrator privileges when you start/stop a java application as Windows Service.
This is from the JSW release notes for 3.5.7:
Implemented a way to install, remove, start, stop, etc., the Wrapper
as a Windows service from a non-elevated (UAC) console. The Wrapper is
elevated transparently using a child process. This is needed starting
with Windows Vista and 2008 for smooth interaction with the Windows
Service Manager.
Cheers,

Unable to access jarfile on server using VNC

I'm trying to run a java application on a server computer by using VNC (tightVNC).
I have the java application in eclipse and it runs perfectly. Then I export it to a runnable jar file and upload the runnable jar file to the server. Now I'm trying to run the application (called ABUN_0.0.0.jar) using VNC.
I use /u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar& (I've used this for previous versions of the app and its worked perfectly). However now I get Unable to access jarfile ABUN_0.0.0.jar
instead of
/u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar&
use this,
/u01/gatc/java/jdk1.6.0_10/bin/java -jar /**path to jar**/ABUN_0.0.0.jar &
or
if Linux System,
check ABUN_0.0.0.jar's permission level.
To give Permission,
chmod 755 /**path to jar**/ABUN_0.0.0.jar

Categories

Resources