Can I run jdk commands in an android application? - java

I'm trying to make an app that can validate other apks using jarsigner from JDK. Is this even possible?

In a word, no. To run JDK commands on the Android, you would need JDK installed on the Android. But you can't install it because no runtime exists for the Android (or the iOS for that matter.)

Related

Does installing android studio on linux require installing java too?

I want to install Android Studio in Linux Ubuntu 22.04. Then, how to install Android Studio properly, and do i have to install java first? If I have to install java, what version of java should me to install? Thank you
Absolutely. Android apps are written in Java. You need to have a JDK installed to compile and run the application code which you have written.

How to create a macOS App Installer with Prerequisites

I'm developing a macOS app written in Swift which will not be distributed via the App Store.
I'm looking to create an installer which will install some prerequisites, more exactly install Java on the machine.
Are there any tools available that can create such an installer for an app?
You could get use of .pkg installator, just put java inside this package and call needed setup actions in pre-install bash script. Or even use script to install brew and call brew to install java, whatever.
There is a GUI tool to make pkg-s called Packages, it works fine and it is free. There is also some documentation on their web site.
You can also create package of any complexity using only built-in, Apple-provided console tools.

How to run Java based .app without JAVA / JRE

We have deployed a Java based application for MacOS and Windows. We have now the issue that some users don't have Java installed and seem to be unable to figure out the error message and install Java on their own. This is only the problem for MacOS users, as we used Lauch4J for Windows, which redirects directly to Oracle in case Java is not yet installed. Is there any possibility to do this also for MacOS?
The alternative would be to ship the application directly with JRE or make it runnable without JRE at all. What are the alternatives and which is the easiest?
Thanks in advance!
It's not that you don't need JRE it's that you need to package the application with it. Look into Launch4j and jpackage or javapacker for java 8.

Using Android Studio's built-in Java on the command line in MacOS

There's lots of info here (much obsolete) on installing Java on the mac, and getting Android Studio to use the right versions.
But recent builds of Android Studio (2.2 and on?) provide their own Java, and for most Mac users, there's just no reason (or desire) to install a browser or command line Java anymore ... until you want to use any of the Studio's shell tools, and realize they're all in java, and the studio's Java is not integrated into the wonder that is java_home.
Obviously, your path vars need to be updated to include the Android SDK, and JAVA_HOME and JDK_HOME need to be set, but the actual details of doing so are thin on the ground.
So ... what are the correct paths and settings needed to simply use the Studio's embedded java and android tools in MacOS shells, instead of installing extra Java instances from Oracle?
Add this to your ~/.profile or similar:
# Use the JDK embedded with Android Studio 2020.3+ for command-line builds
export JAVA_HOME='/Applications/Android Studio.app/Contents/jre/Contents/Home'
# (Use the next line instead for older Android Studio 2.2+)
#export JAVA_HOME='/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home'
Command-line builds via gradlew, and any other well-behaved script, will then use the version of the SDK that ships with Android Studio 2.2+.

How to set different java versions for different apps. on a windows PC?

I have 2 different apps, one of them is a java desktop app and the other one is a c# web app. which uses java applet in order to e-sign. The problem is desktop java app requires 1.5.0_14 and on the other hand web app. requires 1.7 and higher version of java.
I installed both java 1.5 and 1.7 versions on my PC. In order to run desktop java app., I go to C:\Progra~2\Java\jre1.5.0_14\bin and run javacpl to disable 1.7 and enable 1.5. Then I make a shortcut to javaws 1.5.0_14 to my desktop and add the jnlp of this java app (http://abc/appclient/tt.jnlp) to the target of javaws shortcut. After those settings, the java desktop app. runs.
Now I needed to also run the web app which requires 1.7 java. In order to run this app. properly Java 1.5 should be disabled, 1.7 enabled on the Java Control Panel settings. Problem is when you run this web app. the settings for 1.5.0_14 break down, I mean all of the java versions become enabled in javacpl under C:\Progra~2\Java\jre1.5.0_14\bin directory. If I restart my PC, I need to reset the java versions. Is there a way to make this happen without pain in the head?
I would be so glad if you can help me.
By the way, I tried to use batch files, etc. but did not succeed. Is there a permanent solution?
UPDATED:
Here is how I did it back then.
Here is what I do to solve my issue;
Uninstall the older Java -if there is- (in my case it is 1.5.0_14 )
install java equal/higher than 1.7 just to run e-sign on my web application
I prepared a VBScript in order to just run the desired jre version as follows and put jre1.5.0_14, jnlp file and VBScript on the same folder and make shortcut to the VBScript to run.
Set oShell = WScript.CreateObject("WSCript.shell") oShell.run "%comspec% /c D:\TMS\jre1.5.0_14\bin\javaws.exe D:\TMS\tt.jnlp -verbose", 1, True
Set oShell = Nothing
Best Regards.
Thanks in advance.

Categories