Solved

javadoc command in batch file

Posted on 2011-09-09
23
627 Views
Last Modified: 2012-05-12
I trying to write a batch file to run a javadoc command. The problem is the spaces in the path. I've got:

start "C:\Program Files\Java\jdk1.6.0_18\bin javadoc.exe -d  C:\Documents and Settings\jmyUsernmae -sourcepath C:\mySourceCode"

Nothing is produced by this. What am I doing wrong?
0
Comment
Question by:allelopath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 18
  • 5
23 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36513083
You should take each of the parts in the double quotes
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513089
And why fo you need start ?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513096
start "C:\Program Files\Java\jdk1.6.0_18\bin javadoc.exe" -d  "C:\Documents and Settings\jmyUsernmae -sourcepath C:\mySourceCode"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 36513103
actually this way:

start "C:\Program Files\Java\jdk1.6.0_18\bin javadoc.exe" -d  "C:\Documents and Settings\jmyUsernmae" -sourcepath C:\mySourceCode
0
 
LVL 1

Author Comment

by:allelopath
ID: 36513105
I had tried 3 parts:

start "C:\Program Files\Java\jdk1.6.0_18\bin javadoc.exe" "-d  C:\Documents and Settings\jmyUsername" "-sourcepath C:\mySourceCode"


but it gives an error saying it doesn't know what the -d part is then.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513107
actually this way

start "C:\Program Files\Java\jdk1.6.0_18\bin\javadoc.exe" -d  "C:\Documents and Settings\jmyUsernmae -sourcepath C:\mySourceCode"
0
 
LVL 1

Author Comment

by:allelopath
ID: 36513112
Same error with your suggestion
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513115
you had also space beteween the folder and javadoc.exe

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513126
look below - that was still wrong variant
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513133

this should be correct:
start "C:\Program Files\Java\jdk1.6.0_18\bin\javadoc.exe" -d  "C:\Documents and Settings\jmyUsername" -sourcepath C:\mySourceCode
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513135
only those pieces which have embedde spaces should be in quotes
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513138
And if the last varian does not work - first try to run wiothout start in the beginning
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513166


like in this example:

 C:> javadoc -windowtitle "Java 2 Platform" com.mypackage

l
0
 
LVL 1

Author Comment

by:allelopath
ID: 36513185
Got rid of Start, that's better. source path actually has spaces, too:
"C:\Program Files\Java\jdk1.6.0_18\bin\javadoc.exe" -d  "C:\Documents and Settings\jmyUsername" -sourcepath "C:\my Source Code\"

This gives:
javadoc: error -No packages or classes specified.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513195
sourcefilenames  - it says should be the last argument,

so I'd think "C:\my Source Code\*.java"
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513199
It is not the folder with files but the actual files which should be argument
0
 
LVL 1

Author Comment

by:allelopath
ID: 36513210
I understand what are saying, but I need it to travel through that top folder recursively looking for java files. Is this not possible?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513216
A series of source file names, separated by spaces, each of which can begin with a path and contain a wildcard such as asterisk (*). The Javadoc tool will process every file whose name ends with ".java", and whose name, when stripped of that suffix, is actually a legal class name
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513231

http://download.oracle.com/javase/1.4.2/docs/tooldocs/windows/javadoc.html#synopsis

javadoc [ options ] [ packagenames ] [ sourcefilenames ] [ -subpackages pkg1:pkg2:... ] [ @argfiles ]

-subpackages pkg1:pkg2:...
    Generates documentation from source files in the specified packages and recursively in their subpackages. An alternative to supplying packagenames or sourcefilenames.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513235
or maybe you need this part:

packagenames
    A series of names of packages, separated by spaces, such as java.lang java.lang.reflect java.awt. You must separately specify each package you want to document. Wildcards are not allowed; use -subpackages for recursion. The Javadoc tool uses -sourcepath to look for these package names. See Example - Documenting One or More Packages
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36513243

Something like this (and of course mind the rule about spaces and quotes):
 C:> javadoc -classpath \user\lib -sourcepath \user\src com.mypackage
0
 
LVL 1

Author Comment

by:allelopath
ID: 36513258
Well, i just did it through eclipse, but thanks for your answers.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513267
Sure, with Eclipse it is even better
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question