Java -jar No Sound Error with cgoban.jar - java

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

Related

Any way to sandbox an application dependent on an older (non-working) version of JRE?

I have a very old application (published in 2001) I am trying to get working in Windows 7/8/10. There is a setup.exe part of it that is using Java in some capacity, and not working correctly. I suspect it is using java because I decompiled the JAR file packaged with the application and there are references to several setup steps within the .java files (along with a file named setup.java). There is also a jre folder published with the application as well, running the following (dated) version:
F:\jre\bin>java -version
java version "1.3.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)
At first I suspected the application was using the systems environmental variables to use the currently installed version of JAVA, but I ruled that out by completely purging JAVA from the system and retesting - same results.
I next tried to simply update the folder to the latest version. As expected however, there were calls being made that were no longer supported (error message was referencing _JVM_IsVMGeneratedMethodl).
At this point I am running out of options. I could always run this application in a VM (and it works fine), but I would prefer to somehow package it in a nice streamlined way for easy distribution and install. Is there anything I can do? I was thinking something along the lines of application virtualization but still reading up on it.
It's hard to tell without "being there", but I'm guessing that the old (1.3) JVM just isn't compatible with the more modern versions of Windows.
Your best bet is probably running it against whatever version of Windows the app was originally developed on, in a VM.
If you have / can get the complete source code, you could try recompiling it with the version of Java supported on your current system. But it's probably a long-shot.
If it is containing a JRE folder, then you could skip the installer and add some batch file to launch that .jar with the specific JRE via a command of this form:
java -jar pathToYourJAR
btw, you could also consider options to convert to executable, some older are mentioned here:
How can I convert my Java program to an .exe file?
some of them may allow you to select which JRE to bundle/use

Does not load JDBC Library on ARM by execute Java Application

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

Installing JNLP on Ubuntu for Open JDK 7

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)

Java applications don't start via .apps in Finder

I have Mac OS 10.9.3 installed, and when entering java -version in the Terminal it shows:
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)
My problem is that applications which use Java don't work when double-clicking on the .app folders. For example, TuxGuitar just does nothing, and Eclipse gives the No Java virtual machine error. When launching them with the command
open TuxGuitar.app
open Eclipse.app
.. they work both. What could be the problem?
I had the same problem and I fixed this by installing a patch from apple at
http://support.apple.com/kb/DL1572?viewlocale=en_US.
Something is different in the environment of the shell you get in Terminal, compared with the environment Finder.app is running in. You need to figure out what's different.
A few relevant facts:
OS X windowed applications do not read your shell startup files like ~/.bash_profile, so changes you make there to your ${PATH} or ${JAVA_HOME} will not affect windowed applications.
It used to be the case that OS X windowed applications read ~/.MacOSX/environment.plist but apparently that's no longer true in 10.9 Mavericks; see for example this other StackOverflow question.
Java on Mac OS X keeps changing, and can be installed and controlled in a variety of ways. So it's hard to give a general answer; it depends on the history of your system.
Java Mac GUI applications can place restrictions on which JVM will run them, in Contents/Info.plist of the application bundle; look for key JVMOptions and in particular at JVMVersion within that.
Things to try:
Open System Preferences and see if you have a Java Control Panel. If you do, you can use it to select which JVMs are available for running GUI applications, and in what order they will be tried.
Open a "clean" shell by running env -i /bin/sh and then try running /Applications/TuxGuitar.app/Contents/MacOS/TuxGuitar inside that shell; you may get a useful error message.
Use /usr/libexec/java_home -V to see a list of JVMs the OS knows about.
/usr/libexec/java_home -v 1.7 to see which JVM the OS would choose for an application that needs Java 7.
I have the exact same issue after upgrading to Mavericks and I noticed it with muCommander.
As I can run the app manually from the command line, I have the following workaround which I am quite happy with:
Create a shell script workflow using Automator:
Spotlight -> Automator -> Workflow -> "Run Shell Script" -> [shell command]
Then save the Worflow, but instead of .workflow, choose file format Application. Now you have an App you can double-click.
Addendum 1: This is not the answer to your original question as I don't know exactly what the problem is (jbyler's answer might point you in the right directions here).
However, I assumed that your question implies Can I get double-click to work again?, and this workaround helped me to do that.
Addendum 2: I have JAVA_HOME set up and the same version installed as you have. This is a screenshot for the Workflow in Automator:
I managed to fix this by installing the developer kit.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I had the same problem. Open the /Applications/TuxGuitar.app/Contents/MacOS/TuxGuitar with your favourite text editor (it's a shell script) and add "-d32" option to the last line "exec java ...." (position doesn't matter). This will launch java in 32-bit mode. Alternatively you can launch TuxGuitar with "-d32" option (it passes arguments to java) from the terminal.

Eclipse only sees JDK with sudo

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

Categories

Resources