Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-11-2010, 01:06 AM   PM User | #1
alman9898
New to the CF scene

 
Join Date: Jul 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
alman9898 is an unknown quantity at this point
Compiling java code from the command line

This has been frustrating me intensely.

I am trying to compile my source code from the Windows 7 command prompt. I have added the directory in which my *.java file is located to the classpath. Yet, I still get this error:

C:\Users\Alex>javac HelloThere.java
javac: file not found: HelloThere.java
Usage: javac <options> <source files>
use -help for a list of possible options

I'm very confused as to why this happens because if I navigate to the folder where this file is located, it will compile. However, this is not a satisfactory solution since I intend on compiling JUnit tests directly from the command line as well...

Other solutions I have attempted:

C:\Users\Alex>javac -classpath "C:\Users\Alex\AndroidProject\UnitTest\src" Hello
There.java
javac: file not found: HelloThere.java
Usage: javac <options> <source files>
use -help for a list of possible options

I do not think this has ANYTHING to do with typos...

Images showing what I'm doing...

http://yfrog.com/jtpic1ap

http://yfrog.com/7gpic2uhp

Please tell me I'm just doing something stupid...because I have no idea why this will not work...
alman9898 is offline   Reply With Quote
Old 10-11-2010, 09:07 AM   PM User | #2
sujithpr
New Coder

 
Join Date: Aug 2009
Location: Cochin,India
Posts: 39
Thanks: 2
Thanked 1 Time in 1 Post
sujithpr is an unknown quantity at this point
Smile

Quote:
Originally Posted by alman9898 View Post
if I navigate to the folder where this file is located, it will compile.
.
Yes it is the right way of compiling java program. "javac" command will try to find the file in the same directory where you execute the command.
Quote:
Originally Posted by alman9898 View Post
However, this is not a satisfactory solution since I intend on compiling JUnit tests directly from the command line as well...
.
And you can specify classpath option when you run the program.
sujithpr is offline   Reply With Quote
Old 03-05-2013, 09:34 AM   PM User | #3
elJava
New to the CF scene

 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
elJava is an unknown quantity at this point
Quote:
Originally Posted by alman9898 View Post
This has been frustrating me intensely.

I am trying to compile my source code from the Windows 7 command prompt. I have added the directory in which my *.java file is located to the classpath. Yet, I still get this error:

C:\Users\Alex>javac HelloThere.java
javac: file not found: HelloThere.java
Usage: javac <options> <source files>
use -help for a list of possible options

I'm very confused as to why this happens because if I navigate to the folder where this file is located, it will compile. However, this is not a satisfactory solution since I intend on compiling JUnit tests directly from the command line as well...

Other solutions I have attempted:

C:\Users\Alex>javac -classpath "C:\Users\Alex\AndroidProject\UnitTest\src" Hello
There.java
javac: file not found: HelloThere.java
Usage: javac <options> <source files>
use -help for a list of possible options

I do not think this has ANYTHING to do with typos...

Images showing what I'm doing...

http://yfrog.com/jtpic1ap

http://yfrog.com/7gpic2uhp

Please tell me I'm just doing something stupid...because I have no idea why this will not work...
I have the same problem. I need to figure this out for an exam. Why does the classpath option on the command line not find my .java file???
elJava is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:11 PM.


Advertisement
Log in to turn off these ads.