issue with starting java web start application on linux - java

Operating System: Linux version 2.6.18-308.1.1.el5 (mockbuild#x86-002.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Fri Feb 17 16:47:13 EST 2012
Java Version: Match: digest selected JREDesc: JREDesc[version 1.6+, heap=134217728-536870912, args=-ea, href=null, sel=false, null, null], JREInfo: JREInfo for index 0:
platform is: 1.7
product is: 1.7.0_17
location is: http://java.sun.com/products/autodl/j2se
path is: /usr/java/jre1.7.0_17/bin/java
Tried with Mozilla Firefox.
Problem: Unable to start the java web start application for JRE 1.7.0, even though I am using the deployment toolkit.
source for html for JRE 7.0: deployJava.createWebStartLaunchButton(url,'1.7.0');
source for html for JRE 6.0: deployJava.createWebStartLaunchButton(url,'1.6.0');
Note:
The application runs perfectly fine in a Windows environment, and Linux is running the 1.6 version just fine. I also noticed the default JRE of the machine is still 1.6.0, even though I have installed JRE 1.7.0 using RPM from here and when I am trying to install now it is saying that the JRE is already installed.
Update: I have updated the default JRE, now it shows JRE 1.7.0
[root#L3FMV80 defaults]# java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)
[root#L3FMV80 Downloads]# rpm -ivh jre-7u17-linux-i586.rpm
Preparing... ########################################### [100%]
package jre-1.7.0_17-fcs.i586 is already installed

You don't say what distribution you are using. Try installing openjdk icedtea-web, the latter being a web start implementation and a browser plug-in.
You don't have to be using the browser plug-in. You can open the file with the "javaws" program.

I have good solution from this
So after a good long time not being able to play this Facebook game
we’re building for P2P-related research, which runs on Java Web Start,
I finally got pissed today and sat down and finally got to the bottom
of it.
Because Java isn’t free technology and all that, OpenSUSE actually
comes preinstalled with OpenJDK instead of the common version of Java
distributed by Sun. With this default configuration, Web Start (JNLP)
files on the internet will open by default in an open implementation
of Java Web Start called ‘IcedTea Web Start’, which I hear works
reasonably well – but outright doesn’t work for some cases, like mine.
For people who, like me, need to run Sun’s version of Web Start from
Firefox – first, you need to grab and install Sun’s version of the
Java runtime using your software package manager (in OpenSUSE the
package is called java-1_6_0-sun). Verify that you have a program
called ‘javaws’ after this step. You can simply type ‘javaws’ into an
open terminal and make sure it is recognized as Java(TM) Web Start.
Okay, next all we need to do is get Firefox to use javaws when opening
JNLP files. For other distros you’d go to Edit > Preferences >
Applications in Firefox, look for JNLP, and change the setting so it
uses javaws. On OpenSUSE, Firefox is integrated so it takes its
file-association settings directly from KDE. So you’ll have to instead
go to KDE’s systemsettings (Configure Desktop) > Advanced Tab > File
Associations. Here, run a search for JNLP, then add ‘/usr/bin/javaws’
to the top of the Application Preference Order.
We’re done! Next time you open a JNLP Web Start file in Firefox, it
should offer to use Sun’s Java Web Start to open it :)
Useful Link: how to run jnlp files under ubuntu

Related

Firebase Tools and Java 11

This question falls somewhere between Firebase Tools, MacOS and Java. Probably 75% Java, 20% Firebase Tools and 5% MacOS.
Starting with v10.5, firebase-tools started stating that 'Support for Java version <= 10 will be dropped soon in firebase-tools#11. Please upgrade to Java version 11 or above to continue using the emulators.'
I run macOS v11.6.5 on a Macbook Pro from mid-2014. When I go to Java's Downloads page, it recommends Java 'Version 8 Update 331'. Not Java 11.
Information on downloading Java 11 seems to be scarce. Oracle's page of certified configurations includes MacOS 11, but I can't find anywhere obvious where Java 11 can be readily downloaded.
A big part of the problem seems to be the terminology used. If I run java -version, I get:
java version "1.8.0_331"
Java(TM) SE Runtime Environment (build 1.8.0_331-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.331-b09, mixed mode)
Okay, I have build 1.8 of the Java Runtime Environment, aka the JRE if you are a Java enthusiast. That is apparently what is triggering the warning in Firebase Tools.
There is also a Java product out there called 'Java SE 11'. The product itself is ambiguous, but the checksums all say 'SDK'. (A Software Development Kit: a thing that enables developers to develop Java programs. The name doesn't imply a Runtime Environment: a thing that enables Java to run on an operating system.) There is an article out there which claims that, if you install Java SE 11 and run java -version, it will spit out java version "11.0.7". That will probably satisfy Firebase Tools.
But Oracle's release notes say: 'In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.' No longer an option... as in now you implicitly get JRE 11 with SDK 11? Or as in the SDK and JRE are now fully divorced, and the JRE must be ferreted out of its hiding like a wild beast?
UPDATE 6/5/22: Java's checksums page now says 'JDK', and I guess that is better than 'SDK' because it implies 'Java Development Kit', which this Wikipedia article claims to include both a JRE ('java') and SDK (most of the other files).
To install Java SE:
Go here.
Scroll down to find your product. I chose Java SE 11. (Oracle will probably list later versions as they are made available.)
Choose your operating system. I chose MacOS.
Choose your file set. I chose the DMG installer.
Download your chosen file set.
5. Do whatever is required by your platform to install Java SE using the downloaded file set from #5.
After installing Java SE 11, java -version now says "11.0.14" and Firebase Tools is now satisfied. My best guess is that JRE 11 was implicitly downloaded, and that developers need to start ignoring the main Download page used by everyone else. (Why didn't the main Download page recommend Java 11 from the start?) Hopefully someone will see this question and clarify whether in the future, the 'Java SE' product implicitly includes both the JRE and SDK, and that the numbering system will always encompass both. In other words, hopefully when someone says we need 'Java 11', it means that we need to download SE 11, containing JRE 11 and SDK 11.
This link has a JDK installer that solved my problem today. I needed to close and reopen all my VScode windows to get it to work.
https://www.oracle.com/java/technologies/downloads/
With latest versions this error appears: !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using the emulators.
You can download Java SE Development Kit 18 from this link. Just choose your operating system, download and install the file. When installation is complete you need to restart you terminal and voila it works now:
firebase emulators:start
But Oracle's release notes say: 'In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.' No longer an option... as in now you implicitly get JRE 11 with SDK 11? Or as in the SDK and JRE are now fully divorced, and the JRE must be ferreted out of its hiding like a wild beast?
With Java 8 and earlier, the end user of a Java application was responsible for providing a Java runtime environment for the application to run on. This is what the JRE was for. The user would have to install this runtime environment on their system in order to run Java applications. This is also why the https://www.java.com/en/download/ page recommends Java 8 (the JRE), which was the last version of Java where an end-user should concern themselves with installing a runtime environment.
Starting from Java 9, it is now the application distrubutor's responsibility to provide a Java runtime that can run the application. So, there are no more JREs.
The application developer should use jlink, which is a tool included in the SDK, to create a 'runtime image' (essentially a bespoke JRE to run a single application), that can be used to run the application, and bundle that runtime image with the application. The jpackage tool can also be used to create application images (including a runtime image), as well as installers.

The program 'jshell' is currently not installed when trying to run jshell on Ubuntu

I have downloaded and "manually" installed JDK 10 for Linux 64bit edition (for Ubuntu 16.04),
Oracle Java SE Development Kit
(note: I wanted to download the Java9 JDK but this is no longer supported and I was referred to the Java 10 SE Development kit instead).
When I try running jshell from a terminal window I get the following error,
The program 'jshell' is currently not installed. To run 'jshell'
please ask your administrator to install the package
'openjdk-9-jdk-headless' You will have to enable the component called
'universe'
I dont know why the message is asking me to install openjdk when I have installed the classic java version. When I run "which jshell" I dont get any details returned.
Can anyone help me get jshell installed and working ?
JShell is a development tool. You should download and install the Java Development Kit to run jshell, not just the Java Runtime Environment.
On Linux, and specificallly Ubuntu, development tools are not best installed via apt. The exception to prove the rule is RVM, which is installed via apt purely so that it will download ruby and ruby gems dynamically outside of apt.
For Java, the equivalent is SDKman, which is installed via curl. Once you have SDKman then you can install Java and other Java type tools.
SDKman in action:
thufir#dur:~$
thufir#dur:~$ sdk list java
================================================================================
Available Java Versions
================================================================================
12.ea.20-open
11.0.1-zulu
> * 11.0.1-open
10.0.2-zulu
10.0.2-open
9.0.7-zulu
9.0.4-open
* 8.0.192-zulu
8.0.191-oracle
7.0.201-zulu
6.0.119-zulu
1.0.0-rc-10-grl
1.0.0-rc-9-grl
1.0.0-rc-8-grl
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
thufir#dur:~$
Generally, umake, or Ubuntu Make, will install IDE or other development tools. Currently, umake is best installed as a snap.
The upshot is to first install SDKman, then snap, then use snap to install umake. Between umake and SDKman your tools should be up to date.
(Ruby uses a similar RVM, which inspired SDKman.)
I followed the tip given by Ernest Kiwele and others above and set-up my JAVA_HOME partly as described in
How to set JAVA_HOME in Linux for all users
but also by creating a sh script in my profile.d directory. Thank you for the help.
I dont feel completely comfortable with my solution since I have configured my Java using update-alternatives. I dont know why people advise to use update-alternatives to set the version of Java to use if the other depending variables aren't set-up at the same time.

Ecilpse Oxygen.3a Java IDE cannot add window GUI via window builder error opening wizard

I try to use the Eclipse Oxygen v4.7.3a (Oxygen) Java IDE.
I try to use window builder to build a GUI application with Java, but when I try to add the window I have an error message.
I tried to google it, but I cannot even know what that message needs from me.
It says:
problem opening wizard
The selected wizard could not be started.
Plug-in org.eclipse.wb.swing was unable to load class org.eclipse.wb.internal.swing.wizards.application.NewSwingApplicationWizard.
An error occurred while automatically activating bundle org.eclipse.wb.core.java (528).
My java -version output:
OpenJDK version "10" 2018-03-20
OpenJDK Runtime Environment (build 10+46-Ubuntu-5ubuntu1)
OpenJDK 64-Bit Server VM (build 10+46-Ubuntu-5ubuntu1, mixed mode)
I had exactly the same error occur in Eclipse Oxygen.3a on my Mac with Java JDK 10 installed. There is code in WindowBuilder 1.9 that uses a Java feature that was either altered or dropped in Java 10. I was able to resolve the problem by making two changes (they assume that a Java 9 JDK is available on your system; if not, you must install it):
change the Java VM for Eclipse to one in a Java 9 JDK (using the -vm setting in eclipse.ini; see this link for a good post on how to do that)
change the JRE for the project to a Java 9 JRE
The first change is the more important one since Window Builder is a development aid running as part of Eclipse.
I made the project JRE change for my own sanity so I didn't have a mix of Java versions. You may be able to skip that change (I didn't try it).
I still have Java 10 as the default for the system, so you don't have to completely fall back to Java 9 if you install both JDKs. It may take some tweaking to get both Java 9 and 10 installed and have the one you prefer working as the system default.

Android Studio failed to load JVM on Mac OSX (Mavericks)

I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Android Studio. I use Java 7 because I have some Java applications I have to run and they require 1.7. I have not installed Java 1.6, because it is ancient and old. Launching Android Studio from any launcher does literally nothing. Activity Manager never shows it running. I do not want to install Java 1.6.
I did some work and tried to run the executable via command line through the package contents, and for both executables, I get these messages:
I am unsure what I am supposed to do to fix this error. I'm not very adept on a Mac (still somewhat new to it, and its confusing to do power user stuff on this) so if anyone can help me figure it out that'd be great. I'm on the 2013 Macbook Air with plenty of resources for this to run.
Update: This also applies to Yosemite, El Capitan, and all the other versions of OSX that can run Android Studio.
Update 12/11/2014
As of Android Studio 1.0 RC3 you can follow this set of directions to make it work.
I figured it out. You have to edit the android studio's Info.plist file in the package so it uses 1.7. I don't get why Android Studio insists we install and use an outdated, vulnerable version of Java.
Full resolution: http://i.stack.imgur.com/yyYaG.png
To open the package you need to find the Android Studio.app file in the Applications folder and right click it > Show Package Contents.
Edit the plist (I think you might need to be root) and change JVMVersion from 1.6* to 1.7* (or 1.8*, or whatever JDK major version you have). I don't get why that made a difference since my original output said it was using 1.7 anyways.
This fix seems to apply to all of IntelliJ's IDEs (I've seen it on PyCharm as well), though other ones seem to support newer versions of java natively.
As answered by hasternet # Android Studio was unable to find a valid Jvm (Related to MAC OS)
For quick and dirty solution, Follow the answer by Mgamerz; open Android Studio in Finder (CTRL+Click > Show Package Contests > Contents > info.plist) and edit Key JVMOptions>JVMVersion from "1.6*" to "1.6+"
Recommended method as discovered by Antonio Jose is to edit environment variables in MacOS (messing with info.plist is not recommended)
either at program launch (opening the Studio through terminal rather than the icon)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
or setting up the environment through AppleScript at every MacOS startup:
do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
do shell script "launchctl setenv STUDIO_PROPERTIES /Users/username/Library/Preferences/AndroidStudio/idea.properties"
do shell script "launchctl setenv STUDIO_VM_OPTIONS /Users/username/Library/Preferences/AndroidStudio/studio.vmoptions"
(Remember to save the script as Application. Antonio Jose managed with just the first line - AFAIK you can use .properties and .vmoptions to set up additional settings.)
Official instructions: http://tools.android.com/tech-docs/configuration/osx-jdk
(The reason why Android Studio want's to run off of JRE 1.6 is because it apparently makes the fonts look better - feel free to go through that "official" route and install JRE 1.6 # http://support.apple.com/kb/DL1572 - you can then set the JDK to 1.8 in the SDK Location settings - local.properties)
mgamerz is right - The release notes give a much better solution for rc3 and onwards - theres a idea.properties file
(or environment variable)
~/Library/Preferences/AndroidStudio/idea.properties
it also shows what environment variables you can use to set things like the jdk
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
ref : http://tools.android.com/recent/androidstudio1rc3_releasecandidate3released
I did below command on Mac Terminal to fix this problem, please make sure java version and path.
$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
Hey Friends I just Figured it out a simple way to fix this for Mac users.
Open Terminal and type this -> java -version and hit enter.
Output will be something like this:
Now check your Java Version. My Java version is 1.8
So now we need to Open Contents of our Android App.
For that right click the Android.app and then select Show Contents
Like this
Now there will be Content folder, Open that Folder and there you will find Info.plist
Open this info.plist
And you will see this.
In this expand the JVM
Here you will see the JVM version showing 1.6* but our jvm version is 1.8 (for example my jvm version is 1.8)
So we need to change this number according to our jvm version, so i changed it to version 1.8*
Then click save. And you are done.
Now you will see setup wizard running
And you are ready to start your first android programming app.
Here is the Whole Docx file for Android Studio Setup in Mac X
LINK: https://www.dropbox.com/s/9jwjebn5hgydyll/Android%20Studio%20Setup%20on%20Mac.docx?dl=0
I found that downloading an extra Java bundle from Apple fixed the issue.
If you search for this problem then I found the second link was to a blog having exactly this problem, all credit goes to him here
I know that posting links isn't an answer but as you can see from the resolution you need to make sure you have an up to date version of Java and also the Java bundle from Apple, for this reason I have also included the searches needed to get to these websites.
Here is where to download the latest version of Java
If this link is broken then searching "java latest version" return it at the top of the Google list
Here is where to download the Apple Bundle
If this link is broken then searching "Java for OS X 2014-001" returns it at the top of the Google list
For me trying to solve this problem it appears that initially it was an issue that required a work around and then Apple released an official work around download meaning that fiddling in plists is not necessary any more.

Install JRE if not installed

I've been looking, on the web and this forum, for the correct way to include the Java Runtime Environment with my Java application.
I know that the JRE is machine-dependant and thus, the JRE to provide with my application will change if I want to deploy for MAC or Linux for example.
What I really want to know (assuming what I said before is correct), is :
"Is there a way to check whether a JRE is installed on the client machine, and if not install it before trying to run my application ?"
Because I do not think it is possible :
Do you think I should deploy my application with the JRE folder adapted to the client system, and launch my application with a script using the java.exe contained in the JRE folder ?
This avoids installing any Java stuff, but it doesn't look like a good practice to me...
If your application is client-side, I would offer both options: installation with and w/o JRE. Many java applications offers both installations. For example, SmartGit application allows you to download installation with bundled JRE or one that uses existing JRE (where its users responsibility to have the compatible version of java). Many application servers comes with their own JDK already included with the installation.
So, bundling deployment with your JRE is fine if you don't want any trouble with your customers; however, I would allow non-JRE installation as well (to satisfy picky ones :).
If your application is server-side, usually it doesn't come with JRE, but again, this is not a rule.
Moreover, your running/installation script may check if correct JRE or JDK is installed (by checking if the JAVA_HOME is set etc) and then exit if JRE is missing. Even more, the script can even download java and install it locally - although it would be more practical to just use bundled JRE that you have prepared with the application. Or, if JRE is detected, you may ask user if they want to use existing java or bundled.
Bundling JRE is not a big deal. Even I sometimes install java application with bundled JRE, because I switched on my system to e.g. new version or 64-bit version of java that is not supported by application and so on...
Hope this helps ;)
java -version command on CMD of windows tells JVM version; so you can decide if you need to install or not based on the output of this command.
C:\Users\501200I958>java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Categories