• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiling java files

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If my java is stored in C:\Documents and Settings\Welcome\workspace\transform\src\com\coderanch\jaxws\passxml and I would like to compile a file how can I do it??
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well, assuming the top of the hierarchy is the C:\Documents and Settings\Welcome\workspace\transform\src directory. And YourClass is in the com.coderanch.jaxws.passxml package. And you classpath is not set... then this would probably work best...

---> cd "\Documents and Settings\Welcome\workspace\transform\src"
---> javac com\coderanch\jaxws\passxml\YourClass.java

Henry
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did what you told me but I got the following:


C:\Documents and Settings\Welcome\workspace\transform\src>javac -d . DomUtil.jav
a
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Welcome\workspace\transform\src>
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
feda you need to add the bin folder of your java installation to the path environment variable. If you have installed java here

c:\program files\java\jdk1.6.0_07

then your path environment variable must contain

c:\program files\java\jdk1.6.0_07\bin
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your path environmental variable is not properly set. You need to set the path as follows before you compile your code. I assume your jdk is installed as follows C:\Program Files\Java\jdk1.5.0_06, then before you compile your code type the following command prompt

set path=%path%;C:\Program Files\Java\jdk1.5.0_06\bin;.

the java path might change depending upon your installation.
now execute your code.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also I did the following but I got the following error



 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac "C:\Documents and Settings\Welcome\workspace\transform\src\com\coderanch\jaxws\passxml\DomUtil.java"

put it within double quotes, most likely dos does not recognizes spaces.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

feda alshahwan wrote:Also I did the following but I got the following error


Did you do what Ankit told you to do?
Your OS has to know where to find the javac(ie the java compiler) and java (interpreter) to compile and run your commands.
If you are using windows, you need to set the environment variables or at least set the path as Ankit said.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I set the path from windows in detail please
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already mentioned it in my last post. However that is for that particular session, once you close the command window its lost and you have to reset it.
If you wish to set it permanently following steps should help you

My Computer->Properties->Advanced->Environmental Variable

Now select path click edit

at end put a ; and paste the path of jdk\bin and put a ;.

for e.g.

;C:\Program Files\Java\jdk1.5.0_06\bin;.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

feda alshahwan wrote:How can I set the path from windows in detail please


The 'details' would depend on what exact OS you have. Each version of windows (which is what I assume you are using) will do it slightly differently.
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just use the syntax given by Swastik

set path=%path%;C:\Program Files\Java\jdk1.5.0_06\bin

It is independent of the version of Windows...
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic