Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the java classpath: -cp vs -classpath in JDK versions 1.0 through 1.8? [closed]

Tags:

java

classpath

I've been looking at compiling and running Java programs from the command line and I keep seeing different versions of setting the classpath: -cp vs -classpath. I want to think these are identical but can someone more knowledgeable than me confirm or refute this?

like image 908
Daniel Avatar asked Jun 17 '13 21:06

Daniel


People also ask

Is Java version 8 and 1.8 same?

In JDK 8 and JRE 8, the version strings are 1.8 and 1.8. 0. Here are some examples where the version string is used: java -version (among other information, returns java version "1.8.

Which JDK version is most stable?

Update (March 29, 2020): Java 14 is the latest stable release and shows promising new features. BUT REMEMBER it will not offer long term support (LTS). For these reasons, LTS support editions are only recommendations for production releases including Java SE 8 and Java SE 11.


2 Answers

You can easily find answer by checking official documentation. From Windows or Unix versions:

The java command has a -cp option that is an abbreviation for -classpath.

like image 175
Pshemo Avatar answered Oct 23 '22 15:10

Pshemo


They are the same. Do java -help to see all the options. -cp and -classpath do the same thing.

like image 25
austin Avatar answered Oct 23 '22 16:10

austin