45,000 Jobs - Get an Interview Call,  Post Your Resume Here
SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




How to run class file?

        

Reply
 
LinkBack Thread Tools Display Modes
Old 01-04-06, 11:06 PM   #1 (permalink)
Senior Member
 
Join Date: Mar 2006
Location: India
Age: 25
Posts: 126
Thanks: 0
Thanked 20 Times in 11 Posts
Rep Power: 6 abeetha.m has disabled reputation
how to run a class file in java?

__________________
abeetha
abeetha.m is offline Offline   Reply With Quote
Old 02-04-06, 12:45 PM   #2 (permalink)
shaan
 
Join Date: Feb 2006
Location: India
Posts: 60
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 4 shreenath has disabled reputation


by


select the path and then if file is in c it can be done as


c:>java classfilenameEdited by: shreenath
__________________
sreenath
shreenath is offline Offline   Reply With Quote
Old 03-04-06, 09:03 AM   #3 (permalink)
Senior Member
 
Join Date: Mar 2006
Location: India
Age: 25
Posts: 126
Thanks: 0
Thanked 20 Times in 11 Posts
Rep Power: 6 abeetha.m has disabled reputation
thank u very much.
__________________
abeetha
abeetha.m is offline Offline   Reply With Quote
Old 07-04-06, 02:55 AM   #4 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 thesurya has disabled reputation


do we need to set path or class path .ifyes to which folder we need toset my program says


java.lang.NoClassDefFoundError: test1
Exception in thread "main"
Output completed (0 sec consumed) - Normal Termination
thesurya is offline Offline   Reply With Quote
Old 07-04-06, 03:55 AM   #5 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Posts: 2,379
Blog Entries: 4
Thanks: 118
Thanked 319 Times in 238 Posts
Rep Power: 60 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
Hi thesurya,

You need to set the classpath to bin & lib directories in your java_home.

Thanks,
Krishna

sk_kireeti is offline Offline   Reply With Quote
Old 07-04-06, 08:24 AM   #6 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 thesurya has disabled reputation


hi sk


still the program is giving same message. it is getting compiled.


it is saved by its class name where the main method is defined, that main method declaration is also checked. but still the same prob.
thesurya is offline Offline   Reply With Quote
Old 07-04-06, 08:48 AM   #7 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Posts: 2,379
Blog Entries: 4
Thanks: 118
Thanked 319 Times in 238 Posts
Rep Power: 60 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
Hi thesurya,

Can you clearly post the exact steps you are following (including the folder in which each file is located) and the output you are getting.

This is will us to debug the issue further.

Thanks,
Krishna

sk_kireeti is offline Offline   Reply With Quote
Old 07-04-06, 09:36 AM   #8 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 thesurya has disabled reputation


1.


class test_example
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}


2.then saving as test_example.java in c:\


3. open dos then compile by -"javac test_example.java" in the required directory("c:\").


4.then run by "java test_example"-- now it shpws following error


Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.4', but '1.5' is required.
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.



note- in classpath - the value has been set to C:\j2sdk1.4.2_08\bin


thesurya is offline Offline   Reply With Quote
Old 07-04-06, 09:38 AM   #9 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 thesurya has disabled reputation
inreference to the last query the error is some different and let me say i even have updated my java2 platform from net
thesurya is offline Offline   Reply With Quote
Old 09-04-06, 02:20 AM   #10 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Posts: 2,379
Blog Entries: 4
Thanks: 118
Thanked 319 Times in 238 Posts
Rep Power: 60 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
I never got this kind of error message. May be if you uninstall and install (not rei-nstallation) Java software, if may help you. It looks to be a windows registry issue.

May be some one who has more knowledge in this kind of issues can suggest.

Thanks,
Krishna
sk_kireeti is offline Offline   Reply With Quote
Old 10-04-06, 03:19 AM   #11 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 javaranch has disabled reputation
This is very easy to solve.

I have got this several times when I have several different compliers and runtime I have four of them.

Open Regedit Click start > run > type regedit

then go to the 'Software\JavaSoft\Java Runtime Environment\Current version this must be changed und Local Machine ONLY.

Then change the value 1.4 to 1.5 that is it.


Vinitha

J2ee Developer.
__________________
My friends says I am beautiful.
javaranch is offline Offline   Reply With Quote
Old 11-04-06, 03:11 AM   #12 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 thesurya has disabled reputation


in java runtime environment folder i have two folder for java


1-- 1.4.2_08


2-- 1.5.0_06


under both of these folder i have


name&n bsp;&n bsp; type&n bsp; value


default&nbsp ; REG_SZ value not set


Balloon Showm REG_DWORD Ox00000001(1)





the above description is geiven i changed the value to 1.4(and tried for 1.5 too).here it is working in command prompt


but surprisingly in editplus it is not workiing (i have given the path for javac and java command in tools option)


kindly solve this one and can i know what is this registry editor used for . i never came through it
thesurya is offline Offline   Reply With Quote
Old 11-04-06, 04:05 AM   #13 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Posts: 2,379
Blog Entries: 4
Thanks: 118
Thanked 319 Times in 238 Posts
Rep Power: 60 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute

Refer this to get a brief idea about windows registry.

http://www.annoyances.org/exec/show/registry

Thanks,
Krishna
Edited by: sk_kireeti
sk_kireeti is offline Offline   Reply With Quote
Old 12-04-06, 02:15 PM   #14 (permalink)
Junior Member
 
Join Date: Apr 2006
Location:
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 javaranch has disabled reputation
Specific Editpad issues must be treated with looking at Editpad log.
I never worked with Editpad, Javac I do not like.

Registry is a Row data of information Used by OS and other softwares.
It stores information in the form of Binary values and Keys. Each keys will have a value and a Path. In windows registry main root of Tree are HKEY_LOCAL_MACHINE etc. here down the line you find the java Path KEY and Then you changed value.

Very carefull to play with the registry as these information can change the way a software looks. Years before we used to Edit Registry to find viruses ( Still does ). But now we use automated tools to avoid registry errors.

If we delete some of the Keys under microsoft windows. and restart the computer ( sorry try to ) your computer will not restart. Complete reinstallation may be needed.

So I told you the path and do change that path alone and you must keep a backup of the registry before doing a major change.

If you accedently delelte any registry entries. Never restart your computer instead double click the back up and old.

System Recovery console also cannot help in some case.


when you say not working mean there must be proper error message you must respond with the same other wise the debugging is tougher.[img]smileys/smiley36.gif[/img]


__________________
My friends says I am beautiful.
javaranch is offline Offline   Reply With Quote
Reply

Tags
class , file , run


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +6.5. The time now is 09:19 PM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.0