Running Netbeans for Java - java

I have a problem with running Netbeans for Java development..
When I try to run it I get
I checked the config located in <netbeans_dir>/etc/netbeans.conf and found following setting:
netbeans_jdkhome="/usr/"
So, I checked java and javac:
>>java -version
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)
>>whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
>>javac -version
javac 1.8.0_151
>>whereis javac
javac: /usr/bin/javac /usr/share/man/man1/javac.1.gz
So I updated netbeans_jdkhome to /usr/bin/javac. Now, when I try to run Netbeans I get
Cannot find java. Please use the --jdkhome switch.
I also tried to reinstall Java according to this instruction but once I did and changed jdkhome to /usr/lib/jvm/java-8-openjdk I still get Cannot find java.
What should I enter to run Netbeans properly?

Tools -> Java Platforms -> Add platform should display something like this:
Notice that Platform folder has small rectangle that indicates it can be chosen.

Related

Setting PATH in kali linux to run Java Programs

i am new to java & Linux, i have a problem regarding setting PATH in kali linux to run Java Programs, i have set the path as shown below after that i have executed the basic commands of java like java-version, javac, but when it comes to compile a java program it is showing the error as:& also why it is showing lower version of java, though even i have installed latest version of Java i.e JDK1.8.0_31, TIA
root#kali:~# PATH=/home/opt/jdk1.8.0_31/bin:$PATH
root#kali:~# export PATH
root#kali:~# java -version
java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (6b33-1.13.5-2~deb7u1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
root#kali:~# javac
root#kali:~# javac Hello.java
javac: file not found: Hello.java
It is well set. The error message is exactly what is happening. The file is not there.

How to correctly select Java SDK in OS X?

I seem to have a bit of a mess. At the terminal, I get:
> java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Which is good (I'm trying to get Java 8 running). which java gives /usr/bin/java and:
> ls -al /usr/bin/java
/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Here I think I see where Java is actually installed.
Now my problem is that when I code a simple Java program and type:
System.out.println( System.getProperty("java.version") )
System.out.println( System.getProperty("java.vendor") )
I get the output:
1.6.0_65
Apple Inc.
So what am I doing wrong?
p.s. I am using Eclipse and while I can manually select a different JDK to use there, I would like Java 8 to be a system default. For example, I recently downloaded Eclipse Luna which does not open, giving the following error message:
Version 1.6.0_65 of the JVM is not suitable with this product.
Check the java home using:
/usr/libexec/java_home
Move to that directory:
cd /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
cd bin
java -version
To switch the jdk 8 you will need to modify /usr/libexec/java_home to correctly point to java 8.

java version value is different with java and javac

I am getiing java versions different with java command and javac command
java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode, sharing)
javac -version
javac -version
javac 1.6.0_18
where java
C:\Windows\System32\java.exe
C:\Program Files\Java\jdk1.6.0_18\bin\java.exe
path is set to 1.6 but it is picking 1.8
suggest me how to get this resolved.
This is cause by the extremely annoying habit of the Java installer to copy java.exe andjavaw.exe to C:\Windows\System32\java.exe when you choose to install the "public jre" (but because that's the JRE, of course no javac.exe is copied).
And because System32 comes early in the PATH java.exe from there will be used (and before the regular JDK installation will no be searched for java.exe). But as there is no javac.exe in the JRE, that in turn is used from your JDK.
The public JRE is only needed for the browser Java plugin. In 2014 I consider the Java plugin to be dead and (I think) Oracle should change the JDK installer to not install that automatically.
Actually I consider this behaviour a bug to be honest. No installer should copy files to system32

jmxtrans - Cannot execute

I am trying to get jmxtrans to work yet I get the below on ubuntu 12.04 and using openjdk 7.
/usr/share/jmxtrans# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
/usr/share/jmxtrans# ./jmxtrans.sh start /var/lib/jmxtrans/kafka.json
Cannot execute /usr/lib/jvm/default-java/bin/jps -l!
What does the above mean?
It seems that the jps file can't be found in the /usr/lib/jvm/default-java/bin directory. It is available in the '-devel' packages if you want to install those (yum install java-1.7.0-openjdk-devel, apt-get install openjdk-7-jre-devel). It could also be that your JAVA_HOME is not pointing to the correct place if you have multiple java versions installed.
You should not need it however, regular ps works fine. You can add a variable to your configuration that says export USE_JPS=false. The configuration can be found in /etc/default/jmxtrans.
Check out these issues for more information:
https://github.com/jmxtrans/jmxtrans/issues/89
https://github.com/jmxtrans/jmxtrans/pull/109

Sencha Cmd installation on Mac: Java not found

Trying to install Sencha Command 3.1.1 on my iMac (10.8.3). The installer is saying:
The installer could not find a valid Java(tm) on this machine.
Supported versions: Vendor : Any min. 1.6.0 max. any
Following another Stack Overflow thread, I tried linking /usr/bin/java to /Library/Internet Plugins/JavaAppletPlugin.plugin/Contents/Home/bin/java. Now, I get this on the command line:
~ 🍔 java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
So that looks good, but the installer still complains that it cannot find Java. Why can't it?
What eventually fixed this for me, after consulting with Sencha support, was installing the full JDK rather than just the JRE. I don't know exactly why this fixed it, or what the root cause was, but now Command installed successfully and is working fine.
I had JDK installed, but one thing worked for me was exporting $java_home/bin:
export PATH=$JAVA_HOME/bin:$PATH

Categories

Resources