Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007, 08:01 PM
Member
 
Join Date: Jul 2007
Posts: 40
elizabeth is on a distinguished road
netBeans problem Restated
netBeans doesn't Execute the second code Why?
this works
Code:
package HelloWorldApp_pkg; public class HelloWorldApp { public HelloWorldApp() { } public static void main(String[] args) { System.out.println("Howdy"); } }
it doesn't work
Code:
package Project_1_Pkg; public class HelloWorldApp { public static void main(String[] args) { System.out.println("Howdy"); } }
problem
Code:
"class HelloWorldApp is public, should be declared in a file named HelloWorldApp. java"
Can anyone explain to me why?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 10:49 PM
Member
 
Join Date: Aug 2007
Posts: 25
Josiah.Haswell is on a distinguished road
There doesn't seem to be a problem with the actual code. Do you have two different HelloWorldApp classes in separate package namespaces? Or do you only have one HelloWorldApp class in the HelloWorldApp_pkg namespace?

Creating two different packages with classes of the same name isn't a problem, but creating a package with a class of one name and declaring that class as belonging to a different namespace will cause problems.

Also, you may want to use standard Java naming conventions for packages. For example, package names should be lowercase, and begin with the top-level domain of your organization (e.g. org.yourapp.yourpackage.yoursubpackage)

Good luck,

Joe
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with wsimport / Netbeans buk110 Advanced Java 0 03-17-2008 09:47 PM
NetBeans 5.5.1 Help. padutch2 New To Java 6 12-03-2007 05:01 AM
help with netBeans the godfather01 NetBeans 3 11-14-2007 09:54 PM
Problem with display in Netbeans 5.5 Albert NetBeans 1 07-13-2007 05:33 PM
netbeans 64 bit caspermel NetBeans 1 06-27-2007 12:29 AM


All times are GMT +3. The time now is 07:50 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org