We have a Java-application "app.jar" in a unix home directory with a external Sqlite Driver Library.
- myapp/app.jar
- myapp/lib/sqlite-jdbc-3.8.7.jar
Device Udoo ARM Cortex V9 simliar to Raspberry Pi.
java -version
java version "1.8.0_06
Java(TM) SE Runtime Environment (build 1.8.0_06-b23)
Java HotSpot(TM) Client VM (build 25.6-b23, mixed mode)
Try to run this application failed.
java -classpath lib/sqlite-jdbc-3.8.7.jar -jar myapp.jar
It seems that the Application cannot find the Library.
java.lang.Exception: No native library is found for os.name=Linux and os.arch=arm
at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:284)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:65)
I can't find a solution until now. It is possible to copy the .jar File to the jdk/lib folder?
Edit:
Now I tried to add the sqlite-jdbc-3.7.2.jar to the JRE and it works.
jdk1.8.0_06/jre/lib/ext
The newer version sqlite-jdbc-3.8.7.jar does not work.
I compared the SQLiteJDBCLoader code in version 3.8.7 with version 3.7.2 and found some insight. 3.7.2 seems to have a pure java mode while the corresponding code is from 3.8.7 missing. From my little knowledge and a quick glance on the download page, I conclude one would need a native library for the target platform. I could not find a download for ARM.
If you need a pure java datebase, you might take another choice.
I believe your command line is wrong.
If you use -jar, then the -classpath is ignored!
Either the manifest in app.jar needs to refer to the library, or you need to start it like this: java -classpath lib/sqlite-jdbc-3.8.7.jar:myapp.jar name.of.MainClass
Related
Situation
The problem I have encountered is that there will be no sound output from running my *.jar file. I will start it with java -jar cgoban.jar and it works fine except there is no sound.
Possible Solutions
There is a workaround for this problem discussed here: https://senseis.xmp.net/?CgobanProblemsAndSolutions.
It says to employ the Java Web Start with
LIBXCB_ALLOW_SLOPPY_LOCK=true padsp javaws http://files.gokgs.com/javaBin/cgoban.jnlp
and use the jlnp file from here: http://files.gokgs.com/javaBin/cgoban.jnlp.
However, since this workaround includes downloading the jar-file on every start this is not an option for me (as I use an offline machine, bandwidth limitations etc.)
A possible solution might be to run (since it works with javaws)
LIBXCB_ALLOW_SLOPPY_LOCK=true padsp java -jar cgoban.jar
but there is still no sound. I don't understand why it works for javaws, but not for java -jar.
Unluckily it did not help to run
java -jar -Dsun.sound.useNewAudioEngine="false" cgoban.jar
But thanks for commenting.
Another possible solution that I attempted was to download and edit above jlnp-file. I don't want to download the jar-file every time the application starts. So maybe it is possible to download the jar-file once and then have the local jlnp-file point to the local copy (instead of the remote jar-file). However, as my programming skills suck, I have not been able to pull this off.
Additional Information
I'm running an Ubuntu machine with Java installed. java -version gives me the following output:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
An up-to-date version of cgoban.jar for download is available from here:
http://files.gokgs.com/javaBin/cgoban.jar
When I download a copy of Clojure (1.8.0 or any other version), either from Maven Central or the official website, it will claim to be version 1.7.0-RC1.
For example:
$ java -jar clojure-1.8.0.jar
Clojure 1.7.0-RC1
user=>
It also seems that this is, in fact, the version that is run. Since functions that were added in 1.8.0 (specifically string/starts-with?) are not available in the repl (after importing).
When an identical copy of the file (verified by shasum) is downloaded on a separate laptop, the correct version runs.
I have verified this with several versions, including 1.8.0, 1.9.0-alpha17, and 1.5.0-RC2. All of them report as 1.7.0-RC1.
Additional information:
$ java -version
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Using macOS version 10.12.3.
Another (older) version of Clojure .jar may load and override the one specified on command line (or classpath), if you have installed the older Clojure 1.7.0-RC1 as a "Java Extension" on macOS. In practise, your reported behaviour results from placing the 1.7.0 .jar in /Library/Java/Extensions/ or ~/Library/Java/Extensions/ (under your home directory).
A simple solution is to remove the jar file from the Extensions folder.
The Java Development Guide for Mac actually warns about the perils of using the Extensions directory, as it can lead to such problems:
Try to include all of your dependent libraries in your application rather than relying on the Java Extensions directory, because its contents are unversioned and cannot accommodate for multiple versions of the same library.
I am currently having huge issues installing HermesJMS (1.14 or 1.15) on OSX 10.9.2
Downloading the dmg file from their site fails with an error saying the .app file is damaged
So I download the jar file, with the installation being successful.
I downloaded the jar files from here: 1.14 1.15
I then switch to the terminal and run the hermes.sh in the bin directory and I get the following error
~$ ./hermes.sh
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.jidesoft.swing.SplashScreen.create(Unknown Source)
at hermes.browser.HermesBrowser.main(HermesBrowser.java:224)
Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.awt.RenderingHints
at com.jidesoft.swing.JideSwingUtilities.<clinit>(Unknown Source)
... 2 more
Here are my java versions:
~$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Does anyone have a clue as to why this is so?
I am basically wanting to use it to view a ActiveMQ topic
Any help would be much appreciated
Thanks
The problem has to do with Java not enabling web plug-in and Web Start features. I ran into this problem with Java versions 7 & 8 (jdk1.7.0_21.jdk, jdk1.8.0.jdk).
Java 6 is required.
Getting Java 6
Download and install Java for Mac OS X (1.6.0_65-b14-462): http://support.apple.com/kb/DL1572
Then follow these instructions to re-enable the Apple-provided Java SE 6 web plug-in and Web Start features: http://support.apple.com/en-us/HT202643
fyi - Installation locations
These are typical install locations for Java for OSX:
Apple-installed Java for Mac OS X install location: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Oracle Java install location: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
Running HermesJMS with Java 6
To use Java 6 for the life of your terminal window:
~$ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
then run
~$ ./hermes.sh
If your goal is to "monitor" a JMS Topic within ActiveMQ, you can use JMSToolBox on sourceforge
You only need a JRE 8 on the path
The first answer did work for me.
The JAVA_HOME variable issue could be fixed by using jenv utility.
download Java 1.6 as mentioned above;
install jenv;
add Java 1.6 to the list of versions managed by jenv:
jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
Add the following lines to hgermesjms.sh file, # Setup the Java VM section:
jenv local 1.6
export JAVA_HOME="$HOME/.jenv/versions/jenv version-name"
jenv version-name should be quoted by backticks (`), Markdown stole them.
That is how it worked for me.
The fix is displayed in more details in this answer.
How do I get JNLP working for OpenJDK 7 on a Ubuntu machine?
I'm trying to get the source code linked to at http://www.bugaco.com/bioinf/clusterer/ with the text "Download sources" to run on my machine.
Currently, when I try running
javac -cp ".:l2fprod-common-all-7.3.jar:jfreechart-1.0.17/lib/jfreechart-1.0.17.jar" com/bugaco/mioritic/impl/module/project/Main.java
it is giving me the error
./com/bugaco/ui/LoadBean.java:11: error: package javax.jnlp does not exist
import javax.jnlp.FileOpenService;
^
(and many other errors)
which I assume indicates that I need to install JNLP, along with other packages I'll have to install when I get JNLP fixed.
Based on Mike Clark's answer https://stackoverflow.com/a/12608844/38765
I assumed that "Demos and Samples" is the way to install JNLP for Open JDK 7.
I'm on Ubuntu, so I'm trying to use the "Ubuntu way" to install it. I installed openjdk-7-demo , which describes itself as "Java runtime based on OpenJDK (demos and examples)".
It's still giving the error described above. What have I done wrong, or forgotten to do?
I tried browsing the tag wiki for java. The only non-video resource that looked relevant to me in "Beginners' resources" was "The Java Tutorials". The only link relevant from there was "Learning the Java Language". It had a section on packages, but that's only on how to create your own, rather than how to install other peoples' packages.
I'm using Ubuntu 12.04 (precise) 64-bit, and Java 7
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.12.04.2)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
If you want to use JNLP with OpenSDK, you need the IcedTea implementation of JNLP.
In Ubuntu, install the "icedtea-netx" package.
The libraries you need will be in /usr/share/icedtea-web/.
Just use $ javaws xxxxx.jnlp .
It works to me on :
(open-jdk-7 + Ubuntu 14.04)
I have to start by saying that I have just switched to Ubuntu from Windows and I am new to Linux in general. Coming from Windows, I really am not familiar with how exactly the permissions work, the Linux file system, where I am able to create folders that I can use without the sudo command etc.
I use eclipse on a daily basis for android development and other simple java swing projects. I was able to download and extract the latest available version of eclipse (kepler) to this path: /opt/eclipse. Inside this directory is the eclipse executable and other eclipse related files.
I also installed the JDK and verified with the java -version command. It says:
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
I am running on a 64 bit CPU architecture so both programs are the 64 bit version.
Now, my problem is that if I open eclipse from the Unity dash or from the file explorer, it give me this error:
However if I run sudo eclipse in the terminal, everything runs just fine as long as I do it as the super user. I have a hunch that the JDK is installed in a folder that is restricted to normal users and only works if I run the sudo command but this is just a hunch. As I said, I am new to Linux and I am not really sure what I am doing wrong here, I am learning as I go. I need a good explanation as to how to make it start from the Unity dock without the sudo command. Thanks in advance!
You'll want to use the chmod command from the terminal to change the permissions on the Java folder. See this link for more information:
http://www.linux.org/threads/file-permissions-chmod.4094/
Well after running the which java cmd, I noticed that the path to the JDK from the eclipse.ini file was not pointing to the correct location. I fixed the path and now it works. I don't know how the sudo cmd overrides the eclipse.ini path to JDK but well, it works