The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sun Java Platform, Standard Edition 1.5.0_15 (Java 5 branch) iBot Software Releases - RSS News 0 03-06-2008 05:50 PM
Simple Shell Script Question.... [java related] Drags111 Shell Programming and Scripting 3 12-22-2007 05:23 AM
Java compiling error Katkota UNIX for Dummies Questions & Answers 4 12-05-2007 09:35 PM
Newbie Question: passing a variable into java from script? Cailet Shell Programming and Scripting 1 10-18-2007 10:31 PM
Question about compiling (noob) arya6000 High Level Programming 9 12-11-2006 01:28 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-08-2005
ANAMIKA56 ANAMIKA56 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
question about JAVA compiling ..

Hi ,
I don't know if this is the right place to post my question because it relates to JAVA . I am beginner of JAVA , using a tutorial as reference I am trying to run a simple program in JAVA env. I have installed JDSK kit from java.sun.com but when I tried to run a program from the DOS prompt , I am getting this error ,
This what I typed in : C:/Documents and Setting\javac -classpath ExampleProgram.java
Error I got :
'javac' is not recognized as an internal or external command.


I tried to set the environment variable also, but it is not working.

Please help.

Thanks.
  #2 (permalink)  
Old 08-08-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
What env variables have you set ?

JAVA_HOME/bin directory should be in your path. JAVA_HOME is where you
have installed the java sdk.

Also, if you set the env variables, you need to open another command prompt window and then try your command, again.

vino
  #3 (permalink)  
Old 08-08-2005
ANAMIKA56 ANAMIKA56 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
question about JAVA compiling..

Thanks Vino.

I have installed jdk in c:/Program Files directory. Won't I be able to use from this location.
If you don't mind could u walk me through the steps after installation .


thanks
  #4 (permalink)  
Old 08-09-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
If c:\Program Files\j2sdk1.5 is where you have installed java sdk.

You can run javac from this directory as well. But getting a command prompt to traverse to this directory requires you to type in extra. So put c:\Program Files\j2sdk1.5\bin in your path. After that you can run javac, java from anywhere.

It is best that you set classpath to include the current directory. Just append a . to the CLASSPATH settings if not already set.

javac ExampleProgram.java

Look at this instruction manual

vino
  #5 (permalink)  
Old 08-10-2005
ANAMIKA56 ANAMIKA56 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
Hi Vino,
Thanks for your time.

But still I am getting error saying "cannot read:ExampleProgram.java"

These are all the steps I tried .

1. I made C:/Program Files\Java\jdk1.5.0_04\bin (this were I have installed jdk) as my current working directory.
2 . then I setted up my CLASSPATH -->
C:/Program Files\Java\jdk1.5.0_04\bin > SET CLASSPATH=%CLASSPATH%;.

3. then I complied my program from the above location :

C:/Program Files\Java\jdk1.5.0_04\bin >javac ExampleProgram.java
At this stage I am getting this error .
error : "cannot read:ExampleProgram.java" 1 error

Here is what the code I wrote :
class ExampleProgram {
public static void main(String[] args){
System.out.println("I'm a Simple Program");
}
}

Could you tell me what I am missing here? I appreciate your patience and time vino.


Thanks.
  #6 (permalink)  
Old 08-10-2005
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Where did you place the ExampleProgram.java? Right inside jdkXXXXX\bin?? You shouldn't put any user programs inside!
  #7 (permalink)  
Old 08-11-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
I will start again.

You should add the following to your path variables.
C:/Program Files/Java/jdk1.5.0_04/bin

You will need the classpath setting SET CLASSPATH=%CLASSPATH%;.

Suppose, all your java programs are placed in c:/ANAMIKA56

You will need to traverse to c:/ANAMIKA56 and then issue javac ExampleProgram.java

Once the program is compiled, run it as follows: java ExampleProgram

The path settings is necessary because after that, you go to any directory you want and then issue a javac/java. If you dont set the path variable, you need to do the following everytime. C:/Program Files/Java/jdk1.5.0_04/bin/javac ExampleProgram.java.

Like cbkihong said, its good not to put any java programs inside the java installation directory.

vino
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes 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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0