JDK-8335322 : `java` should print warning when `-jar` is used with class path option
  • Type: Enhancement
  • Component: tools
  • Sub-Component: launcher
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2024-06-26
  • Updated: 2024-06-28
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
Relates to JDK-4356783

# Problem
When `java -jar ...` is used together with a class path option (e.g. `-cp`) that option is silently ignored.
This behavior might not be obvious to users, and it will be difficult to understand why ClassNotFoundExceptions occur, especially if different setups with `-cp` worked correctly for the user.

(And also the documentation for `-cp` does not mention that it might be ignored; only the documentation for `-jar` mentions it.)

# Suggested solution
When `-jar` is used together with a class path option such as `-cp` a warning should be printed that the class path option is ignored.




Comments
Moving to JDK for further evaluation.
28-06-2024