Using JDK outside eclipse - eclipse

Eclipse is said to have an inbuilt jdk, can we use it outside eclipse for simple javac eg through command prompt?
I may be wrong in assumptions please guide on that too

Eclipse has an inbuilt Incremental Java Compiler not a full JDK as far as I know.
More information can be found in the documentation and the JDT core page

Perhaps you are referring to the built-in compiler in Eclipse. Different ways to use this is documented here

Related

what is tools.jar replacement ?

I have been receiving the following error on eclipse when i try to build an ant project
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre-10.0.2"
but my JAVA_HOME variable is set to
C:\Program Files\Java\jdk-10
this is the result of the command
echo %JAVA_HOME%
i really tried a lot to solve this problem ,but i don't know much about eclipse,
Edit: i searched some more on the internet and found out that the tools.jar has been removed from the JDK since JDK 9 [link]https://www.reddit.com/r/javahelp/comments/765mwr/installed_jdk_9_and_my_toolsjar_is_missing/
the question now is why is eclipse asking for the tools.jar ,and what is tools.jar replacement ?
I would really appreciate any help
thank you very much
In Java 9 and later, the components that were previously in tools.jar have been turned onto modules. For the javac compiler, you need to use the java.compiler module. This is not a simple drop-in replacement.
If you run into problems with a 3rd-party application (such as Ant) that depends on tools.jar, you need to upgrade the application to a newer version that is Java 9+ compatible.
According to my reading of the Apache Ant site, that means you need Ant 1.10.x. Check the site's download page to see what is currently recommended.
If you are using openJDK11 you can probably use lib/jrt-fs.jar as a replacement of tools.jar

Latex and NetBeans

I have NetBeans 8.0.2 EE edition. I'm wondering if there is a latex plugin supported by Netbeans in the same way as Texlipse plugin in Eclipse. I've been searching online about that but unfortunately I couldn't find a good plugin.
Thank you.
I was looking for it
I found this
http://plugins.netbeans.org/plugin/5749/tex-language-support
you have to build de module, I did with the current code, but doesn't work, I will try to see what happened, you can try to do the same
good look
The best plugin I know of is https://kenai.com/projects/nblatex/downloads .
I have used it extensively in the past, however, I have not tried to use it with a version of NetBeans higher than 7 and so I can't say if it works with the latest NetBeans.

What is the purpose of Java JDK to Eclipse?

I've just installed Eclipse, after i installed the java JDK.
The Getting Started guide (in Eclipse) says i should reference my JDK installation in Window>Preferences>Java>Installed JREs, but that a JRE would also work.
Select the Java > Installed JREs preference page to display the installed Java Runtime Environments. Confirm that a JRE has been detected. By default, the JRE used to run the workbench will be used to build and run Java programs. It should appear with a checkmark in the list of installed JREs. We recommend that you use a Java SDK instead of a JRE. An SDK is designed for development and contains the source code for the Java library, easing debugging.
There was already a JRE set up there (not a JDK), so i did nothing and tried to compile a Hello World (just to see what would happen). To my surprise, it compiled!
I searched a little bit and it looks like this works because Eclipse has a built-in Java Compiler. I tried debugging using the same eclipse set up, and it was also successful.
So, what is the difference between setting a JDK and JRE there? Why is it important to download the JDK, since in my default configuration Eclipse doesn't seem to use it?
Probably the main difference is you get the source to all of the Java runtime libraries (with the JDK) which can be a big help. I always use the JDKs for that reason.
Also if you are debugging, this will allow you to meaningfully step into Java runtime libraries.
There are a number of tools that come with the JDK that don't come with the JRE - JConsole (http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html) springs to mind. This for example can help you understand & monitor the memory usage of your application and so on. Either way if you head into unfamiliar territory, I highly recommend you follow the Eclipse suggestion and use the JDK!
JDK is equipped with different helpful tools, as DotMasta mentioned. Eclipse's "version" of JDK is called JDT. Apart from range of shipped tools, there are also differences between javac and Eclipse built-in compiler ecj, so check here to see the comparison. One of the most important differences is that javac is strict, i.e. with ecj you can create a class file even in case of errors in code, which is perfectly suitable for testing phase, but not for launch :)
JDK contains software development tools which are used to compile and run the Java program.
Plenty of classes and methods in standard jdk library
Javac java compiler
Diffrences and why you will need this?
JDK includes the JVM, standard class libraries, and several other tools that a developer needs in order to create a Java program.
JRE includes the JVM, as the JRE provides some standard libraries and the JVM which can be used to execute a Java program.
You can even look there: http://en.wikipedia.org/wiki/Java_Development_Kit

Eclipse running in JRE but a JDK is required

I always get the above mentioned error when i restart eclipse.I have gone through other posts in stackoverflow and understood how to resolve the problem( i.e by changing configurations in windows>prefernces and editing eclipse.ini file).
But the basic question is what is the meaning of that error?Someone please explain and also provide link to resource on how eclipse works internally with those preferences set.
Thanks in advance..
The JRE runs Java applications. The JDK can also compile Java source code, which is what your Eclipse is trying to do.
Basically Apache Maven requires a Java compiler (javac) which is not part of a Java runtime environment. (JRE) So it asks to use Java Development Kit (JDK) instead because JDKs are including a Java compiler. Nearest explanation for this can be found in below link.
http://wiki.eclipse.org/M2E_FAQ for question "Unable to locate the Javac Compiler Error". How to force Apache Maven to use the Eclipse Java Development Tools (JDT) as its default compiler can be found here.

Check project for use of code introduced in Java 7

On my development machine, I have JDK 1.7 installed, but we are packaging software for use with Java 1.5 and 1.6. It's easy to set the -source and -target options so that the syntax is forced to be a particular version, and the output class is interpretable by a particular VM. But there are other version-isms that are biting me, like the 2-argument constructor AssertionError(String, Throwable) and various other subtle changes.
The one solution I know of is to install every different JDK (1.5, 1.6, 1.7) so that Eclipse can exactly match the execution environment for me. Is there any other way to detect these problems? Bonus points if it's an Eclipse or Maven tool.
How about the Codehaus anmial-sniffer maven plugin? I haven't had reason to try it yet, but thought it looked interesting.
does this tool help? It's command line, I have seen people using it to detect java7 being used.