954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with java

Hi friends

I m new to this site.
I have got a problem.
I cant run Java program on my PC.
If anyone can help plz reply.

manisha
Newbie Poster
21 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Check your environment variables:
I posted this in a previous thread:

Considering you have windows:

Goto start--->right click on my computer--->select properties
Goto the advanced tab, and you should see a button at the bottom that says environment variables...click on that.

The only thing you need to worry about is the PATH variable, and the CLASSPATH variable, nothing else.

SKIP THIS STEP AND GO ON TO THE CLASSPATH, IF IT DOESN'T WORK AFTER SETTING THE CLASSPATH, THEN COME BACK AND SET THIS.
The path variable must point to the bin folder in the sun app server, and the bin folder in the jdk directory. Now, those are two different directories, so you seperate them with a semicolon when creating it. Here is what mine looks like:

C:\Sun\AppServer\bin;C:\Program Files\Java\jdk1.5.0\bin




Classpath....This points to the tools.jar file in the jdk directory. It's pretty easy to find. Here is what mine looks like:

.;%classpath%.;C\Program Files\Java\jdk1.5.0\lib\tools.jar

Your's will look similar, although you do not need the .;%classpath%.; statement.


Next, you need to know how to access your files at the command line.

To do so, you simply type cd/folderName at the command line. The cd stands for current directory. My folder was named javawork, so to access it, I did this at the command prompt:

cd/javawork // brings me to the right directory
javac Hello.java //compiles my program
java Hello //runs my program


Let me know if you don't undestand something or need more help.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Hi everyone,

Check your environment variables: I posted this in a previous thread:

Considering you have windows:

Goto start--->right click on my computer--->select properties
Goto the advanced tab, and you should see a button at the bottom that says environment variables...click on that.

The only thing you need to worry about is the PATH variable, and the CLASSPATH variable, nothing else.

SKIP THIS STEP AND GO ON TO THE CLASSPATH, IF IT DOESN'T WORK AFTER SETTING THE CLASSPATH, THEN COME BACK AND SET THIS.
The path variable must point to the bin folder in the sun app server, and the bin folder in the jdk directory. Now, those are two different directories, so you seperate them with a semicolon when creating it. Here is what mine looks like:

C:\Sun\AppServer\bin;C:\Program Files\Java\jdk1.5.0\bin




Classpath....This points to the tools.jar file in the jdk directory. It's pretty easy to find. Here is what mine looks like:

.;%classpath%.;C\Program Files\Java\jdk1.5.0\lib\tools.jar

Your's will look similar, although you do not need the .;%classpath%.; statement.


Next, you need to know how to access your files at the command line.

To do so, you simply type cd/folderName at the command line. The cd stands for current directory. My folder was named javawork, so to access it, I did this at the command prompt:

cd/javawork // brings me to the right directory
javac Hello.java //compiles my program
java Hello //runs my program


Let me know if you don't undestand something or need more help.

I could not have said it better myself

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

I could: see the installation instructions ;)
They're quite comprehensive for a variety of platforms.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

Hi
Thanx for a reply.I hav already tried to set the path and the classpath. But its still not working.by the way
My path is: c:\matlab\bin;c:\bin;C:\Program Files\ESTsoft\ALZip\;C:\Program Files\Java\jdk1.5.0\bin
& the classpath is:"C:\Program files\java\jdk1.5.0\lib\tools.jar"

manisha
Newbie Poster
21 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 
I could: see the installation instructions ;)

Dont be a party pooper!


Anyways, try adding a period to the end of the classpath:

C:\Program files\java\jdk1.5.0\lib\tools.jar.


Get it. Got it. Good.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Thanx for ur suggestion.

manisha
Newbie Poster
21 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 
Thanx for ur suggestion.

did it work?

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 
did it work?

Thanx for ur help but it havnt worked yet.
I dont know what the hell is the problem here.
It did work one yr back but now i m unable to work it out. :sad:
anyways thanx.

manisha
Newbie Poster
21 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

You should have let me know that it still wasn't working. These problems can take a while to fix.

Now, if you tried putting the period at the end of the .jar extension(.jar.) and it didn't work, try adding this at the VERY beginninng:

.;%classpath%.;
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

You should have let me know that it still wasn't working. These problems can take a while to fix.

Now, if you tried putting the period at the end of the .jar extension(.jar.) and it didn't work, try adding this at the VERY beginninng:

.;%classpath%.;


Hi

Thanx a lot dear for trying to help me.
Ayways after replying u i tried it again n had it done already.
I hav already done what u hav suggested n its working now.
Thanx alot again.

Bye

manisha
Newbie Poster
21 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Your welcome, and glad you got it fixed.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Hi Manisha i am also new to this site you have to set u r classpath.
for eg if you have saved u r program as C:\abc\ then set path to this folder as set path=C:\j2sdk1.4.1\bin; and set calsspath=;.; then u r program will work.
Hi friends

I m new to this site.
I have got a problem.
I cant run Java program on my PC.
If anyone can help plz reply.

anburaj
Newbie Poster
1 post since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

how to set class path ???
can ne1 help me out

coz i tried and it doesnt work

though when i save the code in bin and un it form there itz executes
why is this so ?

c:\java2_13\bin ?
so whtz the proper setpath and classpath i shld give in command

grii_19
Light Poster
30 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

Here is nice tutorial from Sun how to setup PATH and CLASSPATH

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

ey thx problem solved
sum1 mention use echo set path dont know wht it is
but it helped me a lot to solve my query

set path=%path%;c:\j2......\bin
this helped me a lot
thank you alll
problem solved

grii_19
Light Poster
30 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

how to use a spell checker?
Your post is completely illegible.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You