Issue with Netbeans on Linux Mint - linux

I just installed Netbeans using the script on Oracle's website and I'm having some trouble getting it to work. After opening Netbeans I went to open up a simple .java file just to test it out and got this error:
"The JDK is missing and is required to run some Neatbeans modules. Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information."
I have OpenJDK, and I'm not sure what's meant by using the --jdkhome command line option. I also visited the wiki and it's about doing a full installation of JDK, which I don't think I should need to do. Any help is appreciated.

I think it's better to use Oracle Java JDK rather than Open JDK if you want to use Netbeans for java development
You can use this link to set Oracle Java JDK in Linux Mint
So, it's better to follow theses instructions (JDK install) prior to Netbeans install and all things will go well.
Steps:
1-Remove OpenJDK installation
sudo apt-get update && apt-get remove openjdk*
2- Download Oracle JDK you want to install (for example JDK 8)
Download the *.tar.gz one.
example for current version: jdk-8u65-linux-x64.tar.gz
3- Extract the file and create a folder where to move it
tar -zxvf jdk-8u65-linux-x64.tar.gz
sudo mkdir -p /opt/java
sudo mv jdk1.8.0_65 /opt/java
4- Make JDK system default
sudo update-alternatives --install "/usr/bin/java" "java"
"/opt/java/jdk1.8.0_65/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk1.8.0_65/bin/java
At this stage, you can start the installation of Netbeans IDE and it will automatically detect your Oracle JDK setting
I tested a short HelloWorld Java example, and I don't have any issue.
Here is the setting JDK view in Netbeans:
If you want to add the JAVA Home dir to your system
Proceed like this
You have to be in root mode and then edit this file: /etc/bash.bashrc
and add:
#JAVA HOME
JAVA_HOME=/opt/java/jdk1.8.0_65
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
Reboot your Mint system
Now you'll have javac working in command line...

Related

Intellij IDEA 2017.2 can't add openjk 9 on Linux Mint 18

I am using Intellij IDEA 2017.2.5 on Linux Mint 18.2 and trying to add new openjdk-9 SDK but IDEA does not accept openjdk 9 as valid JDK:
I have installed all of my SDKs using apt-get from ppa standard repositories.
This is my update-alternatives --config java/javac output:
Although Intellij declared it would support JDK 9 here, but it seems it is not yet fully compatible with at least opensdk-9.
Maybe refactoring SDK directory and removing 'jre' folder misleads the IDEA to find the SDK 9 home folder.
Any idea why Intellij IDEA claims 'The selected directory is not a valid home for JDK' ?
“ Ubuntu PPA for OpenJDK” currently has very old build of openjdk-9(9~b115-1ubuntu1).
So the IDEA does not recognize it as a valid SDK.
I removed current installed version:
sudo apt-get remove '^openjdk-9.*'
Then I have downloaded newer .deb build(9~b181) files including jre,jre-headless,... from launchpad build archive.
sudo dpkg -i openjdk-9-jre-headless_9_b181-4_amd64.deb
openjdk-9-jre_9_b181-4_amd64.deb
openjdk-9-jdk-headless_9_b181-4_amd64.deb
openjdk-9-jdk_9_b181-4_amd64.deb
Just Execute the above command at a single line, line breaks are for better readability.
Ignore any error complaining about:
"Package libpng16-16 is not installed."
Next execute the following:
sudo apt-get install -f
Now after installing this build of openjdk-9 the IDEA is happy with SDK home.
Thanks #y.bedrov for his useful comment.
Update:
However this solution enables you to declare openjdk-9 in the mentioned IDEA version(2017-2) but you are not able to compile any class within the IDEA itself.
You can only compile your application with elder jdk and run it with openjdk-9. There is an other issue which indicates this here.
In the newer IDEA versions(I have tested 2017.3) this build of openjdk is not allowed to be used as new SDK any more, see this issue.
The short reason is an issue in Debian package which contains incorrectly compiled lib/jrt-fs.jar file.
See this Answer for more information

installing java in linux issues

Im trying to install Java in install but for some reason its not working.
I tried the same way as mentioned in this website-http://www.java.com/en/download/help/linux_install.xml#enable
I see Java installed in my desktop when I try this command,
premvidya#ubuntu:~/Desktop$ ls
jre1.6.0_31 jre-6u31-linux-i586(2).bin jre-6u31-linux-i586.bin
but when I try java - version, I get the following error,
premvidya#ubuntu:~/Desktop$ java -version
The program 'java' can be found in the following packages:
* gij-4.3
* java-gcj-compat-headless
* openjdk-6-jre-headless
* cacao
* gij-4.2
* jamvm
* kaffe
Try: sudo apt-get install
bash: java: command not found
Any help would be appreciated.
Why are you trying to manually install java? There is a repository for this, and it's all managed for you. Uninstall whatever you have put on your system manually and install it via command line.
apt-get cache search java
apt-get cache search jdk
or
start Ubuntu Software Center -> search for java.
Once installed via apt-get, the new java commands will be available immediately in your PATH, so long as you haven't removed anything...
#user1050619
Hi user1050619,
I have come across the solution which will work on any version of Ubuntu definitely keeping other java versions intact.
I have used standalone installation of Java.
For this, please download tar.gz version of Java from
Oracle website.
Suppose, your jdk installation tar file at location /home/don/
don#ubuntu ~ $ tar zxf jdk-7u45-linux-i586.tar.gz
don#ubuntu ~ $ sudo bash
[sudo] password for don:
ubuntu ~ # mv /home/don/jdk1.7.0_45/ /usr/lib/jvm/
ubuntu ~ # cd /usr/lib/jvm/
ubuntu jvm # update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_45/bin/java 3
ubuntu jvm # update-alternatives --config java
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/jdk1.7.0_45/bin/java 3 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/jdk1.7.0_45/bin/java to provide /usr/bin/java (java) in manual mode
ubuntu jvm # java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode)
and you are done here without any hassles.
Happy programming !!
it should be "apt-cache search java6" or just "apt-cache search java". It'll give you a list of all the package related to java. If you want to install sun's java then you download the java-**.bin file like you did and then run "sudo /bin/sh jre-6u31-linux-i586.bin" That'll run the installer from the sun java you downloaded and begin to install. Answer the question and install the package.

installing grails in linux

I am new to using Linux. I installed grails by setting env variable GRAILS_HOME and added ot to PATH variable. I also exported both and when I typed in grails command.. It worked fine. When I closed that terminal session and opened a another new session, all the env variables that I had set up has all gone.
I was wondering how to have them available for all sessions.
Any help is appreciated
Thanks
Edit the .bashrc file of the user launching Grails.
Add the same lines as your commands:
GRAILS_HOME=/home/of/grails
export GRAILS_HOME
PATH=$PATH:$GRAILS_HOME/bin
you need to add $GRAILS_HOME/bin to the PATH (rather than $GRAILS_HOME)
Update
The best way to install Grails on Linux/Mac is to use GVM.
GVM is a tool for managing parallel Versions of multiple Software Development Kits on most Unix based systems. It provides a convenient command line interface for installing, switching, removing and listing Candidates.
In addition to Grails, you can also use GVM to manage your installation of
Groovy
Griffon
Gradle
vert.x
If you have an Ubuntu (or equal) installation. You could add a repository to it. It should do all the stuff for you:
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails
you need to set them under ~/.bashrc file and then type source ~/.bashrc in your terminal so you don't have to close and re-open it again.
In /etc/profile.d/ create a script name grails.sh:
export GRAILS_HOME=/opt/grails
export PATH=$GRAILS_HOME/bin:$PATH
Change /opt/grails to where you unzipped grails.
This will make it available for all users.
If you are on ubuntu define the GRAILS_HOME variable with its installation path in /etc/environment and edit the system path variable as shown in second line
GRAILS_HOME=/opt/grails
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/grails2/bin:"
Groovy Grails Installation:
Before starting up install JAVA on linux system
Check java version using command
$> java -version
Install grails on Linux using Installing-a-grails-development-environment-on-linux
Before installing grails will need to install GVM (Grails version manager) from GVM Tool Installation
After installation of GVM from the above link, we will be able to run Grails sample application. Check it out with command
$> grails -version
Check Environment variable is set or not for Java as well as Grails with command
$> printenv
Create demo application and run the server for Grails using:
$> grails create-app demo
Go to path
$> cd demo/
Run the server
$> grails run-app
Run the server on specific port 9090
$> grails run-app -Dserver.port=9090
Tools and running environment set up for Groovy Grails:
Install GGTS (Groovy Grails Tool Suit) using GGTS with Eclipse IDE and tool
Select Eclipse package on linux from the above link:
YouTube Video Tutorial:
All Grails documentation video tutorials for the installations and running sample application is present here YouTube Channel

How to configure java on Linux machine?

I am installing java to my Linux machine. Downloading the jre and jdk and extracting them did not help only - I assume some environmental variables are also needed. What all path variables are needed to be set? With which values? Expecting the java installs itself to <installation-dir>?
Depending on your distribution it may be easiest to install from your package manager. On Ubuntu, for example, you can do:
sudo aptitude install open-jdk
Otherwise, usually the sun (oracle) version of java comes with a .bin file which you need to make executable and run as root in order to get java properly installed.
You shouldn't need to set any environment variables to get java to work, although some applications will require you to set JAVA_HOME, JDK_HOME and/or JRE_HOME to point to the java install's bin directory. You can see where your java install is by looking at where the symlink from
/etc/alternatives/java
points.
Most Linux systems use the Gnu Java implementation by default and don't change this if you install an additional JDK. Therefore you need to explicitly make your new Java installation the default Java to be used. You can do so by running sudo update-alternatives --config java.
If you prefer graphical configuration, you can install the "galternatives" package, which lets you configure all those application defaults in a nice little UI.
You just need to make /usr/bin/java point to the java executable in the directory where you had extracted the JRE/JDK.
If you extracted it to, say, /opt/jdk1.6.0_23/bin/java, then you need to create a link like this:
sudo ln -s /opt/jdk1.6.0_23/bin/java /usr/bin/java
Prior to this, you can choose to backup an old java installation by:
sudo mv /usr/bin/java /usr/bin/java_old
Here is how I installed JRE:
Install Sun Java Runtime.
Get the jdk for linux. Go to the root Directory. Use the following commands to install.
./configure
make
make install
PATH .= New Path where Java is installed.
To go to the root directory for UBUNTU use command "sudo". For FEDORA use "su".

Where can I download JDK without installation Ubuntu 9.10?

I have Ubuntu 9.10, and Im not a root. This server contains JDK, but I need some updates (change local policy), and its easy for me to use package Java. E.g. on Windows I downloaded jdk1.6.0_05, set JAVA_HOME, and didn`t have any problems.
Is it possible to download full JDK to my home directory, export $JAVA_HOME without any installation manipulation?
Download the jdk Linux "bin" version from Oracle's web site. Wherever directory you run the shell script, it will install the jdk. Very similar to unpacking a .tar.gz.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Update your JAVA_HOME and PATH, etc, and you should be good to go!
You can download the JDK from here. If you are able to modify the server's environment, you can try to modify the $JAVA_HOME. If your server is running with lower privileges under another user, you have to do this with this user.
Download the java .deb package and unpack it with
dpkg -x <deb> .
You will get a /usr dir with subdirs and java distribution.
Copy it to wherever you like and set JAVA_HOME.

Resources