Results 1 to 3 of 3
  1. #1
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default Star character in program arguments

    I'm trying to pass a "*" as a program arguments to an eclipse program, but everytime I do, it instead does a wildcard search for all files matching "*" - which is all files in the directory.

    For my .java file, I went to Properties -> Run/Debug Settings -> click on the launch configuration -> Edit -> Arguments -> Set "*" (in quotes) for the program arguments.

    I then run this code (which simply outputs the arguments), as a test.

    Java Code:
    import java.util.Arrays;
    
    public class Test
    {
    	public static void main(String[] args)
    	{
    		System.out.println(Arrays.toString(args));
    	}
    }

    My output is:
    [.classpath, .project, bin, src]

    This is because these are the files/directories in my running folder - i.e. the files that match "*".


    However, I want a literal "*" to be passed, not to have the files passed. Thanks for the help.


    Edit: BTW I'm running Eclipse 3.5
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

  2. #2
    AlbertoPL is offline Member
    Join Date
    Sep 2009
    Posts
    22
    Rep Power
    0

    Default

    Have you tried using an escape character? Like this:

    \\*

    That's probably what you'll need to do to get the * character to work as an argument, unfortunately you will also get the two slashes. You could parse the input in that case.
    Last edited by AlbertoPL; 10-28-2009 at 02:00 PM.

  3. #3
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default

    Yeah, two slashed works, but I get the extra two slashed at the start, followed by the "*". I really didn't want to have to parse away the slashed, though.

    Edit:
    I know that I can use a static final variable to do the same task as an argument, but I was confident there must be SOME way to pass a star to eclipse.
    Last edited by CodesAway; 10-28-2009 at 02:07 PM.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

Similar Threads

  1. Star pattern help?
    By GeeKunMow in forum New To Java
    Replies: 13
    Last Post: 07-21-2011, 05:59 AM
  2. Need Help with A star
    By 256mxr in forum New To Java
    Replies: 3
    Last Post: 10-11-2009, 02:50 PM
  3. creating a Star
    By jhen in forum New To Java
    Replies: 2
    Last Post: 11-19-2008, 03:41 AM
  4. reading text character by character
    By bugger in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 08:54 PM
  5. Running java program with arguments in Unix"
    By gvi in forum Advanced Java
    Replies: 2
    Last Post: 11-08-2007, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •