Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 559299 - Wrong classpath generation with many classpath entries ends in ClassNotFoundException when launching java application under windows
Summary: Wrong classpath generation with many classpath entries ends in ClassNotFoundE...
Status: CLOSED DUPLICATE of bug 558495
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-17 08:48 EST by Daniel Webelsiep CLA
Modified: 2020-01-17 09:29 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Webelsiep CLA 2020-01-17 08:48:41 EST
When you launches a main class on a project with many classpath entries a temp*classpath-arg*.txt file is generated to avoid problems with too long commandline under windows. Since Eclipse 4.14 the generation of this file under windows is wrong and starting you application will fail with a ClassNotFoundException. 

- How to reproduce -
Create a project in subdirectories with long names and add many external jars in classpath. Also add long -D parameter arguments so the complete commandline (Run/Debug -> Run Configurations -> Show Commandline) is longer when 32767 signs (maximum length of commandline in windows). Now a temp*classpath-arg*.txt is generated is your project root directory when starting the java application. The class will not start because of a ClassNotFoundException.

- Problem -
Since Eclipse 4.14 in the temp*classpath-arg*.txt double quotation marks will be added so commandline is now corrupt under windows.

The commandline looks same in Eclipse 4.13 and 4.14:
C:\Program Files\java\jdk11.0.6_10\bin\javaw.exe -Xms256m -Xmx800m -D... "@c:\Java\Workspace\Project\.temp-Project-classpath-arg-1579265588184.txt" MainClass

The temp*classpath-arg*.txt is now different:
4.13
-classpath c:\Java\Workspace\Project\ext\commons-lang-2.6.jar;...
4.14
-classpath "c:\Java\Workspace\Project\ext\commons-lang-2.6.jar;..."

With the double quotation marks classpath is not loaded correctly and java application will not start. This can directly reproduced on windows command line. Remove the double quotation marks and the application runs fine.
Comment 1 Andrey Loskutov CLA 2020-01-17 09:29:14 EST

*** This bug has been marked as a duplicate of bug 558495 ***