BP Forums
New to Java - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: Java (https://bpforums.info/forumdisplay.php?fid=19)
+---- Thread: New to Java (/showthread.php?tid=556)



New to Java - vijayraj34 - 07-09-2012

hi,
am new to java, i wrote a simple hello world program in eclipse.
-----------------------------------------------------
lachu.java
-----------------------------------------------------
Code:
public class lachu {
    public static void main(String[] args){
    System.output.println("This program displays the name lachu ;-)");    
    }
    
}
-----------------------------------------------------
but after running its shows an error

"Error: Could not find or load main class lachu"
please any 1 tell me what should i do.


Re: New to Java - brandonio21 - 07-09-2012

Hello Vijayraj34!

First of all, welcome to the forums! A little tip for you: whenever putting code into a forum post, please enclose it with the code tags "
Code:
" and "
" - I have already edited your post to be as such.

I have never encountered this problem while using eclipse. The only suggestion that I have is that you right click on the project and "Run As>Java Application", as such:

[Image: xfirstgany70.gif.pagespeed.ic.TgkwA6Gett.png]

I suggest that you read this article to get familiarized with the basics of Eclipse: <!-- m --><a class="postlink" href="http://www.vogella.com/articles/Eclipse/article.html">http://www.vogella.com/articles/Eclipse/article.html</a><!-- m -->

Also, in the code you submitted, System.output.println should be changed to System.out.println


Re: New to Java - Vinwarez - 07-10-2012

Just a little tip:
If you write Java in Eclipse, it would be easier if you change the settings to Java projects. Here is how to do that: Window > Open Perspective > Java.


Re: New to Java - vijayraj34 - 07-10-2012

[Image: error.jpg]

this is my error, the same code if i run in net beans works perfectly, why?


Re: New to Java - brandonio21 - 07-10-2012

Wow, that is really weird! Do you have the latest version of Eclipse and Java installed?

If reinstalling does not fix the problem, I have uploaded a .zip file that can be accessed at this link: https://dl.dropbox.com/u/398377/Java.zip. Simply extract it and run Eclipse (Java>Eclipse>EclipsePortable.exe). If it runs properly, then it was a problem with either your Eclipse or Java installation.


Re: New to Java - vijayraj34 - 07-12-2012

yup the new portable eclipse is running perfectly.
thank you for that.
and i have latest java also.
but actually in my old eclipse android developing tool was there, because of that the problem was coming or something else? pls explain me <!-- s:-) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->


Re: New to Java - brandonio21 - 07-12-2012

Hm, well it could have been a number of things. The android development kit may have messed something up, Java may have simply been misconfigured on your Eclipse. Like I said before, I have never encountered that error so I have no clue...


Re: New to Java - vijayraj34 - 07-23-2012

Can any 1 tell me how to connect a database to java program and i also want to access(R/W) database with a java program. Just give me very simple sample program.

db:MS Excel or MS Sql 2008


Re: New to Java - brandonio21 - 07-23-2012

I have no clue how to do this, sorry about that. However, if someone else on the forum knows, hopefully they'll chime in!