United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6519476 -cp option in java.exe and javaw.exe is handled differently for wildcards(*)
JDK-6519476 : -cp option in java.exe and javaw.exe is handled differently for wildcards(*)

Details
Type:
Bug
Submit Date:
2007-01-30
Status:
Closed
Updated Date:
2010-04-04
Project Name:
JDK
Resolved Date:
2007-01-31
Component:
tools
OS:
windows_2000
Sub-Component:
launcher
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
6
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description
FULL PRODUCT VERSION :
NA

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
There is a difference in handling  "-cp"  option in java.exe and javaw.exe with wildcard.
We can add all jar files in a directory to classpath using wildcard option. But this works only while using java.exe. Wildcard does not work in javaw.exe
Suppose  C:\Temp\lib contains two jar files a.jar and b.jar ,then we can use wildcard while specifying classpath.

e.g.
java -cp C:\Temp\lib\*  javaprogramname
When java.exe all the jars inside C:\Temp\lib are added to classpath.

javaw -cp C:\Temp\lib\*  javaprogramname
When using javaw.exe jars inside C:\Temp\lib are NOT added to classpath.






STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Suppose  C:\Temp\lib contains two jar files a.jar and b.jar

Then run the following program with java and javaw.

java -cp .;c:\Temp\lib\* ClassPathTest
This gives output as ".;c:\Temp\lib\a.jar;c:\Temp\lib\b.jar"
This is correct behaviour.

javaw -cp .;c:\Temp\lib\* ClassPathTest
This gives output as ".;C:\Temp\lib\*"
This is wrong behaviour. Wildcard options is ignored.


ClassPathTest.java
-----------------------------------------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JTextPane;

public class ClassPathTest {

	public static void main(String args[]){
		JFrame frame = new JFrame("Test");
		JTextPane textpane = new JTextPane();
		frame.getContentPane().add(textpane);
		textpane.setText(System.getProperty("java.class.path"));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(500,500);
		frame.setVisible(true);
	}

}

---------------------------------------------------------------------------------------



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
ClassPathTest.java
-----------------------------------------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JTextPane;

public class ClassPathTest {

	public static void main(String args[]){
		JFrame frame = new JFrame("Test");
		JTextPane textpane = new JTextPane();
		frame.getContentPane().add(textpane);
		textpane.setText(System.getProperty("java.class.path"));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(500,500);
		frame.setVisible(true);
	}

}

---------------------------------------------------------------------------------------

---------- END SOURCE ----------

                                    

Comments
EVALUATION

This is a duplicate of 6510337, please see that bug for more information.
                                     
2007-01-31



Hardware and Software, Engineered to Work Together