ProcessBuilder with open command fails on OSX - java

I am encountering a problem related to macOS.
To explain the case, we try to update an old auto-update system for mac that just replaced the old jar files, with a new code that will automatically open a .pkg installer file after his download. (the only way for us to update all the application, using Sparkle or other framework is not possible at this stage).
The .pkg file is signed with an "Developer ID Installer ID" certificate.
The .app file is signed with an "Developer ID Application ID" certificate.
But...
When application is launched by double clicking it, or from the terminal with an "open" command, when it comes to the part of code where we try to launch the pkg via a ProcessBuilder and the "open" command, nothing happens, and the Apple console app says that a security issue occured (-67062), nothing more.
However, when the same Application is launched directly via the java command determined by the JavaApplicationStub (copy pasted from the Apple Console Application log), it works without any problem, and the pkg opens fine.
What could we do to overcome this one?
UPDATE:
I also discovered that the command 'spctl -a -v" returns :
MyApp.pkg: rejected
source=no usable signature
Unless it is used with the parameter "--type install" which gives:
MyApp.pkg: accepted
source=Developer ID
I don't know if it matters or if it the expected result but it may help
UPDATE 2 :
Digging further in High Sierra logs (not accessible with the Console, although it seemed provided for that...), with the following command :
log stream --debug
I was able to see that the issue came from the jspawnhelper file located in the "lib" folder of the JRE, that was not signed by Oracle...
By the way, this means that we must include a JRE bundled with a Java app, with all executable properly signed with a "Developer ID Application" certificate.
But...still not solved...
Another error occurs, again with the "open" command, but it goes a little further.
Now I have the following, thrown by the builtin Installer.app from Apple :
No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting.
And still no idea, as my package already contains an Info.plist...

Related

Why does Java.exe suddenly fail to find files/modules even though Windows Explorer shows they exist

We're experiencing a strange issue - has anybody seen anything similar?
We have a Java/JavaFX desktop application that has been running successfully on a Windows platform (Server 2012) for almost a year.
Recently we moved the application to a different Windows platform (Server 2019, virtual machine).
The app is installed on a shared drive and is started several times a day. It initially runs successfully but at some point in the day will no longer start.
The command line is:
java -p WolfToolkit.jar;WolfToolkit_mods -m com.mycompany.wolftoolkit/com.mycompany.start.StartGUI
WolfToolkit_mods is a folder containing jars for the required modules. When the start-up error occurs, Java.exe reports thatvarying required modules cannot be found. After a lot of diagnostic testing, it appears that Java.exe can no longer detect any of the jar files in the WolfToolkit_mods folder even though Windows Explorer shows the correct content.
If I copy folder WolfToolkit_mods to WolfToolkit_mods2 and change the command to
java -p WolfToolkit.jar;WolfToolkit_mods2...
then the app starts correctly.
If I re-copy just one of the jar files into WolfToolkit_mods and use the original command, then only that file is visible. If all files are re-copied then the app runs correctly.
So, the behaviour is as if Java suddenly views WolfToolkit_mods as being empty and only detects each jar file when it is copied back in. Meanwhile Windows sees no problems. I should also mention that on rare occasions Java.exe suddenly starts reporting that WolfToolkit.jar is "Module format not recognized". Again, re-copying the file resolves the issue.
Any ideas on what this could be or how to diagnose? Thanks.
Windows Server 2019 Standard v10.0
JVM: OpenJDK 64-bit Server v11.0.10+9
This looks to have been caused by the virus checker which was quarantining all .jar files as "suspicious". Presumably when java.exe was trying to read the files on the module path the virus checking software intervened and the effect was that java.exe couldn't locate module-info and so reported missing modules.
Thanks to those who took the time to respond.

JDK 7 Update 80 installation issue "A semi-colon found in selected path"

I'm trying to install JDK 7 on a Windows 7 machine and constantly getting the error "A semi-colon found in selected path" no matter what path I select for the installation.
Tried with different updates of JDK and it didn't help either.
EDIT: Installation log shows the following error:
Thu May 05 06:34:19 2016
:: JDK installation failed. Return Code: 1603, ErrorCode: 0
This error message is displayed by the Microsoft Windows Installer engine and is a general error code that indicates a problem occurred during the installation.
Read on to learn how to sidestep this speed bump.
The following is a non-exhaustive list of known causes for this error:
Short file name creation is disabled on the target machine.
An Install Script custom action is prototyped incorrectly.
A file is locked and cannot be overwritten.
The Microsoft Windows Installer Service is not installed correctly.
The Windows Temp folders are full.
The setup was corrupted after installation and, therefore, fails with this error during un-installation.
An older version of Install Shield Developer is being used.
A general error occurred during the installation.
Print and File sharing is not installed or enabled when installing MSDE 2000.
How to Avoid this Error
The following solutions have resolved this error in the majority of cases:
Make sure short file name creation is enabled on the target machine. You can check to ensure that the target machine does not have short file name creation disabled by navigating to the following registry entry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
Make sure the value "NtfsDisable8dot3NameCreation" is equal to 0. This indicates that short file name creation is enabled. A value of 1 indicates that this functionality is disabled. You should change the value to 0.
After modifying this value, the target machine should be rebooted before attempting to launch the setup again.
Note: If the target machine should normally have short file name creation disabled, it can be disabled after the install completes by resetting "NtfsDisable8dot3NameCreation" to 1 and rebooting.
To ensure that the Windows Installer Service is properly installed and configured, it is recommended that users install the file InstmsiA.exe on Windows 95/98/Me or InstmsiW.exe on Win NT systems. These files are shipped with your InstallShield product and are located in the following location:
<Product Path>\Redist\Language Independent\i386
Empty all temporary folders. The specific temporary folders for a machine can be determined by accessing the DOS prompt and typing set. Note the values listed for TEMP and TMP, and delete all files in those locations.
Make sure no other applications, including utilities such as virus scanners, are running in the background. Close all running applications and utilities, and launch the installation again.
If this error occurs during un-installation, use the Microsoft Windows Installer CleanUp utility to uninstall the installation.
Once the installation has been successfully un-installed, you can then debug the project to determine what caused the original error.
Put your installer executable to C:\ and run it from there.
More info here: http://wills-tech-notes.blogspot.com/2015/12/cannot-install-java-semicolon-found-in.html
The Error which you are getting is normally it throws during java update installation, Not, the first time installation.
Please kindly follow the below steps to resolve your issues. Let's give a try.
Step 1:
Just want to ensure if you have already java installed on your machine partially.
Follow the below entries in command prompt:
java -version - If it throws error we are good.
echo %JAVA_HOME% and echo %JRE_HOME%
echo %PATH% - If you see the Java entries you may need to clear all this.
echo %CLASSPATH% - Here as well as said in above.
If no results from the Step 1, Please follow Step 2.
Step 2:
Check your C: drive for to verify there should not any Java installation folders. If yes, Please delete those.
Clear all your logs from your machine(If it contains any existing java related logs)
https://www.java.com/en/download/help/plugin_cache.xml
Step 3:
Actually, we do not require to install the Java, instead we can download the Zipped java file and locate into dedicated drive.
And then, make all your environment variables entries into this location. In, this case you are good i believe.
If you still face issues, do let me know?
Try this and maybe you'll get your job done
1 Close the installer when you see Java error 1603. (It has installed a
bunch of files, but exits prematurely.)
2 Open javacpl.exe from C:\Program Files (x86)\Java\jre1.8.0_XX\bin (or
for x64, C:\Program Files\Java\jre1.8.0_XX\bin) where XX is the update
number.
3 Uncheck "Enable Java content in the browser" on security tab and click
OK to close Java control panel
4 Retry installing Java. It usually succeeds for this time.
5 Open javacpl.exe again (see step #2)
6 Check Enable Java content in browser on security tab and click OK to
close Java control panel
7 If it still fails, try uninstalling windows update KB2918614, then
reboot and try these steps again.
Try following steps:
Run installer from c:/
Run jdk*...*.exe /log msi.log to see installation logs, please attach
them if it won't help you understand a cause of the problem
In the related JDK bug an issue with an environment was a cause of the problem.
uninstall KB3139923 helped in my case
I had the same problem with version 8 and the solution was to run the installer as Administrator (right click, then "Run as Administrator").

Write to console from a native javafx app created with Inno Setup and maven

I have a JavaFX app, and I am using the maven plugin javafx-maven-plugin to create an app bundle (app.exe in Windows, generated with Inno Setup).
The app runs in console mode when arguments are given.
The problem is that when running in console mode, I can't see the mesages printed to console. The messages (written with System.out.println) don't appear in the Windows console. But they are generated, because if I redirect the output to a file (app.exe > out.txt) the file contains all the messages.
I have tried to run the .exe with cygwin and even compiled the whole project in Linux, and in both of them the output is correctly displayed in the console. So the problem seems to be only when running the javafx exe with the Windows console (cmd). I guess the stdout is redirected to somewhere. How can I change this?
First of all: thanks for using the javafx-maven-plugin, I'm the maintainer of that maven-plugin.
short version: you can't do very much
long version:
The problem comes with the native launcher of the JDK and has nothing todo with InnoSetup, nor Maven.
Quoting the source-code itself this is what happens:
Basic approach:
- Launcher executable loads packager.dll/libpackager.dylib/libpackager.so and calls start_launcher below.
- Reads app/package.cfg or Info.plist or app/<appname>.cfg for application launch configuration
(package.cfg is property file).
- Load JVM with requested JVM settings (bundled client JVM if availble, server or installed JVM otherwise).
- Wait for JVM to exit and then exit from Main
- To debug application by set env variable (TODO) or pass "/Debug" option on command line.
- TODO: default directory is set to user's Documents and Settings.
- Application folder is added to the library path (so LoadLibrary()) works.
After digging a bit inside the launcher, if found the spot, where the STD-output is retrieved, which gets compiled, because on windows-systems "USE_JLI_LAUNCH" is not set. The real problem with this comes with the condition to only append that console-writer when being compiled with DEBUG-flag
It might be a bug/fluke within the JDK itself, I'll try to find something and might file that as bug on oracle-bug-tracker.
EDIT: after some further digging, there is something I found interesting: the generated EXE-file is a simple windows-executable, no cli-executable as seen in the launcher-source-code, that is the reason you dont see any console-output but having the result when pipelining into some file.
Workaround: create/compile your own native launcher-file using some redirects as described here:
Redirecting cout to a console in windows
https://bobobobo.wordpress.com/2009/03/01/how-to-attach-a-console-to-your-gui-app-in-c/

Terminal vs Eclipse PosixFilePermissions

By running the same command from the Eclipse and from the command line I get 2 different results:
With Eclipse everything works fine, however with the command line I get the following error message:
PosixThing.java:17: error: error while writing PosixThing: PosixThing.class (Permission denied)
This error message does not appear if I run "sudo javac PosixThing.java".
As it if was not strange enough, the same code with a different file located in the same directory (Desktop) does not give me any problem. (I am talking about mere txt files just to test the PosixFilePermissions function).
I checked the file permissions and everything is -rw -rw -rw As well as the others'. Do not know why it happens only with that specific file.
Running on Ubuntu 11.10 jdk 1.7.
Any suggestion to what it might be?
It sounds like a file / filesystem permissions problem of some kind:
Check the owner, group and permissions for the file, and all directories on the file pathname.
Check that you are running Eclipse and your command shell as the same effective user.
Check that you are not attempting to write to some kind of "funky" file system; e.g. a Windows file system mounted on Linux, or a FUSE file system of some kind.
If you've got SELinux enabled, check that's not causing the problem. (That's unlikely.)
It is also possible that you are running different releases / versions of Java in the two contexts, or even that Eclipse's file system cache is out of sync. (It is not clear to me what contexts the code is actually running in.)

Cannot execute Java app on Vista Business - "Cannot find the main class... Program will exit"

I have written a Java GUI app (using Netbeans 6.7) requiring Java 1.6. I successfully run it on my XP PC and also my Mac OSX (10.5.7).
My client is running Vista Business, and cannot run the application by double clicking the jar file. He can execute it from the command line: "javaw -jar ..." The error received is: "Cannot find the main class... Program will exit".
I've asked the client to do the following:
install the latest JRE
run JarFix
I've verified that:
JRE is installed in correct location
jar file association is correct
application works (as I have tested it on XP and Mac OSX, and the client can run it from the command line)
Any ideas on what else I can investigate? Note, Netbeans created the main jar file, and also a lib directory with a couple of other Jarfiles. I've unzipped the jarfile and examined the manifest file (which looks good). The correct main class is also within the app's jarfile.
Does the client need to be careful as to where the application is executed from in Vista?
Thanks very much.
Prembo
Does exactly the same JAR file work on other operating systems?
Is the manifest file (META-INF/MANIFEST.MF) in the JAR file correct? One catch to watch out for is that the manifest file MUST end with an empty line; if it doesn't, the last line in the manifest file will be ignored. So, for example, if the last line in your manifest file is something like this:
Main-Class: com.mypackage.MyProgram
and it is not followed by an empty line, then Java will ignore the line and it will not be able to find the main class of the program.
See Sun's Java Tutorial about deploying Java programs in JAR files for exact details about how to package your application in a JAR; it also contains the warning about the manifest file needing to end with an empty line.
Also, double-check if the right version of Java is used. Are you using the exact same version of Java as on Windows XP? Try:
java -version
to see which Java version is being used.
I'm running Vista Enterprise and have very little differences between it and other Windows versions (with regards to Java).
Here are some random ideas that may or may not work:
Have you tried: right clicking on the Jar -> Open with -> Java(TM) Platform SE Binary
Could it be permissions related? (probably not since it runs via the command line)
Have you tried it with UAC off? (UAC sandboxes java apps, and they can't write to certain locations like Program Files)
Did you make sure they have the same files as you in JAVA_HOME/lib/ext/
you could try setting environment variables:
JAVA_HOME=<your_java_home>
CLASSPATH=.
PATH=<your_java_home>\bin
Sometimes JDK needs to be installed separately,along with the net beans IDE. If you have jdk installed then you can try checking for classpath,path in the environmental variables.

Categories