Solved

javadoc command in batch file

Posted on 2011-09-09
23
563 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countX 22 70
IT Company 5 69
topping1 challenge 7 53
advertisement module in core php 4 92
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

746 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now