MacOS: Cannot open JAR File - java

I have been trying to install a pair trader on my Mac and have not been having success. Links/specs provided below.
When I try to install the JAR file, I first get the error that this app is from an unknown developer. When I go to system preferences, unlock, and click "open anyway", I get the following error:
Java Application Failed
Check console error for possible messages related to "/Users/USER/Downloads/ptltrader-1.6.0-macosx.jar"
I've tried everything on the internet and just can't figure it out. Any help would be appreciated - TIA.
macOS Big Sur 11.6.8
java version "17.0.5" 2022-10-18 LTS - This is from running "java -version" in Terminal.
Java Version 8 Update 351 (build 1.8.0_351-b10) - This is from the Java Control Panel.
Link to what I'm trying to install: https://github.com/quantverse/ptltrader/releases
When I click "open anyway," I expect the JAR file to open and run. I have also tried to "Command + Click" the file in finder, and when I choose "Open With," the only option is JavaLauncher.

java -XstartOnFirstThread -jar ptltrader-1.6.0-macosx.jar 2>&1 | tee err-out.log
(since your error message seems to indicate a gui threading issue)

Related

Issue with environment variables JAVA and Android for using cordova (Linux 16.04)

I am trying to build an android app with cordova. I have followed each step and I have solved many issues but in this last step, when I input the command "cordova build", I get the following message:
"Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/home/javiertxu/Android/Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio"
I will show here the file ~/.bashrc with my environment variables.
Image with ~/.bashrc content file
One strange thing is when I "echo JAVA_HOME" it prints an empty message, then I think that the real issue is relationed with that (you can see it in the following image) empty echo image, or maybe the file .bashrc is not the correct file which I should to modify.
When I use the command "readlink -f $(which java)" I get this direction "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java". If I print $ANDROID_HOME I get /home/javiertxu/Android/Sdk.
This is all the information I can provide, so I hope that someone can help me solve this.
Thanks.
Image of .profile:
~/.profile content

Original error: Could not find 'aapt' in ["/usr/local/share/android-sdk/platform-tools/aapt"] Appium - Eclipse

I am currently trying to learn about Appium Automated Testing. Everything is setup perfectly on my Mac.
All my environmental variables are set up correctly :
export ANDROID_HOME=/Users/abc/Library/Android/sdk
export
PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
However when I run the eclipse program, eclipse throws an error saying:
remote stacktrace: UnknownError: An unknown server-side error occurred
while processing the command. Original error: Could not find 'aapt' in
["/usr/local/share/android-sdk/platform-tools/aapt","/usr/local/share/android-sdk/emulator/aapt","/usr/local/share/android-sdk/tools/aapt","/usr/local/share/android-sdk/tools/bin/aapt"].
Do you have Android Build Tools installed at
'/usr/local/share/android-sdk'?
So my question is why eclipse is looking for Android SDK tools in usr/local , my sdk tools are located in
/Users/abc/Library/Android/sdk.
How can I tell eclipse to look for the appt,adb, etc in my User folder and not the admin usr folder.
My expectation is that your PATH variable has /usr/local/share/android-sdk/emulator/aapt entry and it is resolved before your additions of the ANDROID_HOME variable.
So either remove that Android SDK which lives under /usr/local/share/android-sdk/ from your operating system like:
brew cask uninstall android-sdk
or amend your PATH variable definition so your "good" Android SDK installation goes before anything else like:
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
See Appium Java Code examples for more information regarding proper setup of Appium environment. You might also want to check the integrity of the infrastructure setup using appium-doctor
appium-doctor --android
I just struggled with on MacOS Catalina 10.15.3, Appium 1.10.1, Appium Doctor v.1.13.0 trying to set up Android with Appium.
Make sure you are changing the correct file. You have 3 possible locations.
~/.bash_profile
~/.profile
~/.zshrc
I was editing my ~/.bash_profile instead of ~/.zshrc you can have a situation where you are setting the correct path but not in the right file.
If your trying to get going with Android Appium in Mac here is what I put in my ~/.zshrc at the bottom
# Android Paths for Appium
export ANDROID_HOME=/Users/**PUT_YOUR_USER_NAME_HERE_WITHOUT_STARS**/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
Also if you don't want to edit in a terminal-based editor use the following command to open the files in a text editor.
open -e .bash_profile
open -e .zshrc
open -e .profile
After editing do not forget to save.
Quit your Terminal.
Run Appium_Doctor
The following post helped me out a lot when setting up my Appium
appium-workshop/Appium Mac Installation Instructions
https://github.com/isonic1/appium-workshop/blob/master/Appium%20Mac%20Installation%20Instructions.md
If you have a system-wide eclipse installation, it usually won't read your environment variables from your .bashrc or .bashprofile, but from /etc/environment.
If you don't want to modify this file, or if it doesn't exist on a Mac, then you can always set the variables at a project level. This is done in the "Environment" tab of the configuration (run, debug, external tools,...) you're running within Eclipse, like this:

Unable to connect Serviceable Agent (sun.jvm.hotspot.HSDB) to running jvm on windows 7 (32 Bit)

As per the link I successfully be able to connect HSDB to running jvm process on Ubuntu by following steps below:
(On Ubuntu Terminal) set SA_JAVA=/usr/lib/jvm/java-8-oracle/bin/java
(On Ubuntu Terminal) echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
(On Ubuntu Terminal) java -Dsun.jvm.hotspot.debugger.useProcDebugger=true -classpath /usr/lib/jvm/java-8-orcale/lib/sa-jdi.jar sun.jvm.hotspot.HSDB
For Windows 7 32 Bit and from the same link I tried to connect sun.jvm.hotspot.HSDB with running jvm process but I am facing following problems:
(On command prompt) set PATH=C:\Program Files\Java\jdk1.8.0_40\bin;d:\windbg;%PATH% . But in the above command I am not being able to find d:\windbg. For this dependency I Google a lot and also installed Microsoft Windows Debugger but after installation it has different folder hierarchy (c:\WinDDK\7600.16385.1).
For a while I skipped "windbg" and execute the following command.
Which gives the following Screen.
On the above screen I entered running jvm process id which I gathered from Windows Task Manager and clicked on OK button.
The following screen appears and caused an exception.
I know the link I followed is very old. How can I run sun.jvm.hotspot.HSDB on windows. Or is there any other tool that I should follow?
The problem is, that you are using java.exe from your jre insteand of your jdk to start hdsb. That's why it's looking for sawindbg.dll in your jre\bin (where it isn't found) instead of your jdk\bin (where the dll is). You can see that in the LinkError error message.
So use:
C:\Program Files\Java\jdk1.8.0_40\bin\java.exe -cp C:\Program Files\Java\jdk1.8.0_40\lib\sa-jdi.jar sun.jvm.hotspot.HSDB
Or better change your path to always use the java.exe in your jdk. Other tools also have problem with the jre one as well.

Android.bat can't run java

I know this question has been beaten to death but I still cannot get the SDK Manager to run on my Windows 7 Home.
I downloaded the eclipse + adt bundle. The SDK Manager.exe is in the sdk folder where I try to run it from. I even tried copying it to the tools folder and tried running from there but no luck.
The error I get is:
Failed to execute tools\android.bat:
The system cannot find the file specified.
The file clearly exists. I tried running it as "Administrator" as well.
Next I tried running the android.bat file itself which says:
Windows cannot find 'E:\path\to\batfile'.
Make sure you typed the name correctly, and then try again.
I then ran it as "Administrator" which at least detects and tries to execute it. I added in a few pause statements to android.bat itself to prevent it from closing.
Here is what I see:
'"E:\ADT\sdk\tools\lib\\find_java.exe" -s' is not recognized as an internal
or external command, operable program or batch file.
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
Not sure why it says that because when I run where java in cmd I get this:
C:\Users\(MyUser)>where java
C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe
And when I open cmd and manually run
'"E:\ADT\sdk\tools\lib\\find_java.exe" -s'
it works fine.
I then tried setting the java_exe in android.bat to
set java_exe=C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
After commenting out the find_java I ran it again and this is what I get:
'"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar lib\archquery.jar' is not
recognized as an internal or external command,
operable program or batch file.
Invalid path
And once again, when I manually run it, I get:
C:\Users\MyUser>"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar E:\ADT\sdk\t
ools\lib\archquery.jar
x86_64
Am I missing something or should I finally give up trying to get it to work on my windows machine.
Your where java shows too many java.exe, the find_java.bat will try to look for javaw as well in the folder where java is.
set JAVA_HOME and make sure the echo %PATH% points to your main jdk installation.

Unable to run threaded java jar file on Mac OS X 10.6.8 with Java 1.7.0.45 using pacifist

I have installed Java 1.7.0_45 on Mac OS X 10.6.8 using Pacifist [http://www.charlessoft.com/] however I am unable to run a jar file which I have downloaded. The jar file is a threaded application.
The error message I am getting is:
java -jar context.jar
2013-10-31 14:14:41.898 java[330:a07] *** NSInvocation: warning: object 0x109356390 of class 'ThreadUtilities' does not implement methodSignatureForSelector: -- trouble ahead
2013-10-31 14:14:41.900 java[330:a07] *** NSInvocation: warning: object 0x109356390 of class 'ThreadUtilities' does not implement doesNotRecognizeSelector: -- abort
Trace/BPT trap
Is there anyway I can run the jar. I have set the JAVA_HOME path properly and java -version is showing 1.7.0_45 as the version.
The same application works properly on Windows Java 1.7.0_45 and also on Linux Java 1.7.
The web search for the solution and the given keywords return very few results and none of them have any specific solution in it. I am new to mac so I am not fully able to understand the issue.
Alternatively, is there anyway I can run Java from folder in Mac like I can do in windows and Linux by just extracting the Java contents and changing the JAVA_HOME. If that is possible then I should be able to run my JAR.
I had kind of same problem while installing an application through jar file, my Java was not detected by the jar application installer,
Over here I see that one of the method is not accessible, could be a same problem. But I am not very sure of it.
make sure you have rt.jar in your JAVA_HOME/jre/lib/ folder
In case you don't have then you are required to have it through the process of creation of symbolic link.
In the command below replace your_java_version with proper version matching your requirement.
sudo mkdir -p /System/Library/Frameworks/JavaVM.framework/Versions/<your_java_version>/Home/jre/lib
Go into the directory:
cd /System/Library/Frameworks/JavaVM.framework/Versions/<your_java_version>/Home/jre/lib/
Create symbolic link :
sudo ln -s ../../../Classes/classes.jar rt.jar
Hope this solves your problem.
I get the exact same problem with MacOS 10.6.8 and JDK 7. In order to run the jar I had to use the System JRE which is 1.6.x (In my case I wanted to install Squirrel
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar >squirrel-sql-3.6-MACOSX-install.jar

Categories