JAR will not run without Java SE DK - java

Im trying to make my first real java project,and it seemed to be going fine. I build a JAR and it works fine on my main PC. However, when i move it to my laptop it did not work. I got an a JNI error. I managed to make the program work by installing the DK on my laptop as well, but i thought you only needed a runtime environment.
Im using SE DK 14, and intellliJ IDEA. I tried updating my java version, checking the path variables, but only installing the Developer kit seems to work. Both machines were 64-bit Windows 10 machines
I really want to make it only need the java RE, any ideas?
edit: The exact error is
"A JNI error has occurred, please check your installation and try again",
followed by
"A java exception has occurred."
Im using Java 8 update 251 on both devices and Java SE DK 14.0.1 on the device where i made it on. I tried reinstalling , rebuilding and looking into settings of my build, but im not very familiar with Java, maybe i missed something. I just followed this tutorial to make the Jar

Related

Not working java on Mac m2 MacBook Air (any jar sent error)

It used to work on the MacBook pro 14 on the m1 pro. But now it has stopped working on it too. This is an application for the operation of IP KVM Aten cs1708i. As soon as I click Connect, the program hangs and then gives an error. I did a full reset of the mac and the same thing. Please help - I've already tried everything I could.
java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/qs/570kgrkd07qf5r_67blv4d040000gn/T/libiKVMLib_V1.0.dylib
I tried to install various java builds (Azul,oracle, liberi). Java is installed - but the application does not work. Mac Os Ventura OS.
First try to see if your system sees Java. Go to a terminal and type
java -version
If it errors out, you need to add JAVA_HOME to your class path. Your class path is where your system looks for commands. Try google for installing java on your mac first and see how far you can get. Come back if you need help.

How can I launch Image Asset Studio (Android SDK commandline tools) from the command line?

I am trying to run Image Asset Studio from the Android SDK and am encountering an error I cannot solve.
To give a little bit of background, I am presently limited by an ageing laptop (AMD A4-5000, 8 GB RAM, 1 TB hybrid disk [256 MB? SSD]) and, whilst I don't really have any major issue with Android Studio IDE, I find it very bloated and eats up my CPU time and memory. Visual Studio Code on the other hand, suits my cross-platform developing needs almost perfectly, is lightweight and with a plethora of extensions covering all I have needed thus far.
I am attempting to simply execute the Image Asset Studio .jar file from the command line and am encountering a Class Not Found error that suggests my paths might not be configured correctly, but as far as I can tell, all is well... all the other tools I have used have all worked as expected, but this is the first time I have tried to use one of the JAR applets from the /lib/ directory.
I have the latest (AFAIK) Android SDK command-line tools installed in my home directory, and I am trying to launch the Image Asset Studio from the command line. Two examples I have tried are:
~/android/tools/lib$ java asset-studio-26.0.0-dev.jar
~/$ java ./android/tools/lib/asset-studio-26.0.0-dev.jar
These give me the following error, or variations thereof:
Error: Could not find or load main class android.tools.lib.asset-studio-26.0.0-dev.jar
Error: Could not find or load main class asset-studio-26.0.0-dev.jar
Also, I have tried with the -jar flag:
~$ java -jar ~/android/tools/lib/asset-studio-26.0.0-dev.jar
no main manifest attribute, in /home/noscere/android/tools/lib/asset-studio-26.0.0-dev.jar
Different error, same effect :-)
I was previously getting a different error, which related to the wrong Java JRE being executed (I have 11 installed as well as the required 8 - solved with a quick sudo update-alternatives --config java). Here is my current Java version:
~/android$ java -version
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (build 1.8.0_342-8u342-b07-0ubuntu1~20.04-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
For reference, sdkmanager --version gives an output of 7.0 - if that helps identify my SDK version.
Is it possible to be successful in running any of the SDK Java apps from outside of the Studio IDE? All the other command line tools (sdkmanager, avdmanager, adb, etc.) are all working seamlessly thus far. In fact, I've not encountered any issue with my Visual Studio Code + SDK command-line tools development environment (well, that hasn't quick-fixable), until now...
My environment variables relating to the Android SDK are as follows (and all correct):
export ANDROID_HOME=$HOME/android
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export REPO_OS_OVERRIDE="Linux"
I'm stumped. Google-searching has thus far been fruitless. I'm loathe to install Android Studio IDE just for this, when I have successfully developed several apps over the years without needing it. I'm loathe to admit defeat.

Eclipse IDE error,cmd shows "“Java.lang.classnotfoundexception:version”"

Does anyone know what should I do after I delete all java program( java SE and eclipse IDE for Java Developer ) and then reinstall them over and over again almost the whole day? But it still can't work when i tried to write Java.
It did successfully install jave when I typed javec at cmd, but then I found cmd show that
Java.lang.classnotfoundexception:version after I typed java version.
And then I open eclipse IDE for Java Developer, the error occurred as below:
An error has occurred. See the log file C:\eclipse\configuration\1528876404969.log
And it did change the number when I reopen it, such as 1528881289007.log
Already installed: jdk-10.0.1 and jre-10.0.1, and add the path at environment variables under window 10 64bits.
It would be appreciate for taking your time for answering my question.

how to start NetLogo with java7 under OSX mavericks?

I have just installed osx mavericks, and Java SE6 just disappeared from my system... anyway, I already have Java SE7 and I am happy with that, no need to reinstall Java SE6 since my NetBeans already works on Java7 and NetLogo too if I start it from terminal...
I am wondering how to tell the plist file of my NetLogo 5.0.4 to look for the JavaSE7 folder... any help much appreciated.
Best,
Simone
Answer
You might think that changing "1.5" to "1.7" in these Info.plist lines:
<key>JVMVersion</key>
<string>1.5+</string>
would work, but it doesn't. That's because Java 6 is from Apple but Java 7 is from Oracle, and "Apple java applications and Oracle's aren't executable compatible" (source).
Unless you want to mess with making a new NetLogo app bundle using Oracle's AppBundler tool, the simplest way to get the app running under Java 7 is to download the Linux version of NetLogo and use the supplied netlogo.sh launch script.
More info
When running headless, NetLogo has been tested thoroughly on Java 7. For headless runs, I definitely recommend Java 7 because it's faster.
The NetLogo GUI, however, hasn't been tested with Java 7. Once you get it launched, it will probably mostly work, but you might have problems or incompatibilities. We'll probably switch eventually (it's issue 197), but the work on that hasn't been done yet. That ticket would be a good place to record any problems that you find.
If you decide to fall back to Java 6, you can get it from http://support.apple.com/kb/DL1572 . (link is current as of October 2013)

Can't run my project in eclipse because java force closes

I hope this is more worded to be on topic because me not having the ability to code because of a java issue is off topic apparently.
When I try to run my project in eclipse. Eclipse just sais at the bottom with no stack trace. If I compile the jar file and run it with javaw it does nothing. If I run it with java it brings up the java(tm) platform has stopped working.
What I have tried:
Changing association of .jar to use java and javaw
tried uninstalling java and reinstalling
installing windows updates
restarting my computer
cleaned registry
running it in command prompt (just pulls up a window saying "Java(tm) platform se binary has stopped working." There is no stacktrace inside the prompt either.)
scanned for any malware/viruses
using the "fix and restore windows 8 option"
My system:
Windows 8 :/
java 7 latest 64 bit Update 13
java SE dev kit 7 Update 13 (was happening before I installed it)
16 gigs of ram
I can give you more info if need be.
Jars work on my other computer just fine.
edit: Still no luck. 8 out of 8 places I asked for help I got down voted. Looks like im not developing anymore.... Thanks.
Well, there is a known bug with this message, the workaround should be to disable d3d acceleration by adding this as a VM argument: -Dsun.java2d.d3d=false

Categories