Life is easy because we write the source code.....
Prithvi Sehgal wrote:Hello,
If you closely observe your code, you are compiling class E and then trying to run class A. Thats why
its giving this issue. Another problem is, you should try to declare your class A public, rather then default
access.
HTH,
Prithvi Sehgal wrote:Try to make your class public A. Can you post your complete source code, i will compile at my machine and tell you.
It shouldn't be a problem.
BR,
Prithvi Sehgal wrote:Hello,
Please use CodeTags so that your code
snippet is appealing.
Well, its working perfectly fine on my machine. Please check your JavaFiles folder, is A.class file is getting
created there or not. Try to put your java files, in jdk/bin and run from there and see, because the main
issue i can see is, your .class file seems to be missing.
HTH,
Chirath Uralagamage wrote:
Prithvi Sehgal wrote:Hello,
Please use CodeTags so that your code
snippet is appealing.
Well, its working perfectly fine on my machine. Please check your JavaFiles folder, is A.class file is getting
created there or not. Try to put your java files, in jdk/bin and run from there and see, because the main
issue i can see is, your .class file seems to be missing.
HTH,
A.class file is created mate. It compiles. But doesn't run. I moved the file to jdk/bin and ran it from there. Same problem.
Chirath Uralagamage wrote:I am using windows 7. I don't know whether it is a problem of the OS or not. But I'm quite sure that my codes are correct. The destinations are also correct. The source file is also in the picture attached.
Thanks in advance mates
Chirath
OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
Chirath Uralagamage wrote:I am using windows 7. I don't know whether it is a problem of the OS or not. But I'm quite sure that my codes are correct. The destinations are also correct. The source file is also in the picture attached.
Thanks in advance mates
Chirath
Shiva.Om Kumar wrote:
Chirath Uralagamage wrote:I am using windows 7. I don't know whether it is a problem of the OS or not. But I'm quite sure that my codes are correct. The destinations are also correct. The source file is also in the picture attached.
Thanks in advance mates
Chirath
Same code what you have in first post. No Change......
Now try following....
(Compile)
C:\>javac E.java
(run)
C:\>java A
Check out the reason below....
C:\>dir *.java
09/20/2011 10:45 AM 265 E.java
C:\>dir *.class
09/20/2011 10:55 AM 552 A.class
Hope it would be helpful...
dilan alex wrote:
Chirath Uralagamage wrote:I am using windows 7. I don't know whether it is a problem of the OS or not. But I'm quite sure that my codes are correct. The destinations are also correct. The source file is also in the picture attached.
Thanks in advance mates
Chirath
Hi Chirath,
Set your classpath corectly and try to run it again.
do it like this
.;%JAVA_HOME%\lib;
Regards,
Dilan.
Tommy Delson wrote:Tested and it works perfectly, your issue must be a windows environment issues, you need to check you "java" run time environment and windows 7 configuration correctly.
The problem seem like your run time environment is corrupted, try to uninstall and reinstall the JDK or reconfigure the JDK.
Prithvi Sehgal wrote:Hii,
Its working perfectly fine on windows 7 64 bit, i am using windows 7 only. Please always keep in mind, java has nothing to
do with platform as it is platform independent. It seems to be your JDK issue.
BR,
Prithvi Sehgal wrote:Hi,
Do you have teamviewer with you. Add me up, i will be online in somtime, may be i can help debug it.
BR,
If you closely observe your code, you are compiling class E and then trying to run class A. Thats why
its giving this issue. Another problem is, you should try to declare your class A public, rather then default
access.
folder. In command prompt go to this<your_jdk_path>/bin
folder and<your_jdk_path>/bin
KARTHICK.C , SCJP6-93%
(Born to Win)
karthick chinnathambi wrote:
If you closely observe your code, you are compiling class E and then trying to run class A. Thats why
its giving this issue. Another problem is, you should try to declare your class A public, rather then default
access.
This has nothing to do with the problem . Any class that is NOT public can be saved with any Name . But if you compile that JAVA file the class file generated will be of the name <defined_class_name>.class
In this case if you compile E.java you will get A.class.
Since you haven't declared any packages just put your .class file intofolder. In command prompt go to this<your_jdk_path>/bin
folder and<your_jdk_path>/bin
execute "java A" command . If you still have the issue , let me know.
OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
This has nothing to do with the problem . Any class that is NOT public can be saved with any Name . But if you compile that JAVA file the class file generated will be of the name <defined_class_name>.class
In this case if you compile E.java you will get A.class.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Bert Bates wrote:my compiler couldn't read the original .jpg
Chirath Uralagamage wrote:I am using windows 7. I don't know whether it is a problem of the OS or not. But I'm quite sure that my codes are correct. The destinations are also correct. The source file is also in the picture attached.
Thanks in advance mates
Chirath
Are you better than me? Then please show me my mistakes..
Javin Paul wrote:@Chirath Uralagamage , have you managed to resolve the issue or are you still searching for solution ?
Prithvi Sehgal wrote:Dear Chirath,
Where is your jdk installed, is it in the C drive? Is your JAVA_HOME defined?
Try running using the following command
java -cp A
If your jdk is in C, then try to run as a Administrative user. It might help. Let me know if it is fixed.,
BR,
Chirath Uralagamage wrote:
Prithvi Sehgal wrote:Dear Chirath,
Where is your jdk installed, is it in the C drive? Is your JAVA_HOME defined?
Try running using the following command
java -cp A
If your jdk is in C, then try to run as a Administrative user. It might help. Let me know if it is fixed.,
BR,
I don't know how to define JAVA_HOME. And I tried the java -cp A command,it gives a long error or something. I am logged into the administrator account of my Win 7,and yeah,jdk is in C:/Program Files/Java. Still am getting the problem
Are you better than me? Then please show me my mistakes..
Bert Bates wrote:my compiler couldn't read the original .jpg
Prithvi Sehgal wrote:Here is how you define your environment variable
Go to Computer
Right Mouse Click -> Click Properties
On left side Click -> Advanced Environment Settings
Advanced Tab - Bottom Click Environment Variables
On user variables click NEW and give
name of variable -> JAVA_HOME (All in caps)
variable value -> D:\jdk\jdk1.6 (its for me, for your give the root to your jdk)
See below System variables
Find the variable PATH -> click on Edit Path and at the end of Path put a semicolon and append like this
;D:\jdk\jdk1.6\bin;
Put same way on the CLASSPATH as well.
HTH,
Acetylsalicylic acid is aspirin. This could be handy too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|