Import package does not work - beginner help

Hi, I'm a beginner with java. I just trying to figure out how to use packages. I followed everything in the tutorial, but I can't figure out why my simple example does not work.
I made the following directories three, for the sake of the example.
in /home/username/Desktop I created a directory named it
inside it I created prove
inside prove I created test1 and test2
Inside test1 I created the following sample class:
package it.prove.test1;
public class HelloWorld
     private String message;
     public HelloWorld(String message)
          this.message = message;
     public String getMessage()
          return this.message;
}in the directory test2 I created this other one:
package it.prove.test2;
import it.prove.test1.HelloWorld;
public class HelloWorldProgram
     public static void main(String[] args)
          HelloWorld hw = new HelloWorld("Guten Tag, Welt!");
          System.out.println(hw.getMessage());
}So now I have this three:
it
it/prove
it/prove/test1, it/prove/test2
As I said in test1 there is HelloWorld.java and in test2 HelloWorldProgram.java.
When I compile HelloWorld.java, it worked fine.
When I try to compile HelloWorldProgram.java, the compiler says that cannot find package it.prove.test1..
Why that? What did I make wrong?
Sorry both for my bad english (it is not my first language) and for the really trivial question (I'm a really beginner).
Tnx to whoever will help

Assuming you are running on Windows here.
Packages are directly tied to the classpath. Before java can find the it.prove.test1 package, it needs to be a part of the classpath. To make this possible, you need to add the root of the path, where the 'it' directory is in, to the classpath, like this:
javac -cp .;/home/username/Desktop file.java
the -cp switch tells java which classpath to use; it consists of two elements:
. = current directory
/home/username/Desktop = the directory containing the 'it' package root
When run like this, it should work. The same goes for running the code, you would run it like this:
java -cp .;/home/username/Desktop it.prove.test2.HelloWorldProgram
Hope that gives you the hints you need.

Similar Messages

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

  • Air 2.7 and MacOs Lion: iPhone packager does not work

    hi. After upgrading from Snow Leopard to Lion the iPhone packager does not work. It throws an error concerning the Application Version Number. Is this a Know bug? Is there a work- around?  Thanks.  Michael.

    Yeah sorry, the start of my descriptor looks like this:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <application xmlns="http://ns.adobe.com/air/application/2.7">
      <id></id>
      <versionNumber></versionNumber>
      <filename>d</filename>
      <description/>
      <name></name>
    When I go to compile the app the compiler inserts that line into my descriptor at the very bottom (just before the application tag closes). It's weird, I tried setting the <application xmlns="http://ns.adobe.com/air/application/2.7"> back to 2.6 and it works and seems to compile in 2.7 (as I noticed the timer bug).
    Anyway, I only tried 2.7 because I heard the GPU fullscreen bug had been fixed, but given that the timer issue still remains I'll go back to 2.6 for the time being.
    Thanks

  • After installing acrobat my Microsoft office package does not work properly, word will not open and in my email i can't select anything with the mouse

    After installing acrobat my Microsoft office package does not work properly, word will not open and when I want to write an email in my outlook email i can't select anything with the mouse. so copy past en delete are not an option.@

    Are you using any MS Office third party Add-ins? Test:  Remove third party Add-ins other than PDFMaker.  Test to see if the MS Office apps run afterward.
    Did you attempt to repair MS Office?  Test:  Go to Add/Remove Control Panel run Repair.
    Finally, have you tried testing to see if it's PDFMaker?  Test: Use the Add/Remove Control Panel to modify the Acrobat installation to remove PDFMaker.  See if MS Office applications launch and behave correctly?

  • Installed new update on my windows 7 laptop. Now I tunes does not work! Help!

    Installed new update on my windows 7 laptop. Now I tunes does not work! Help!

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Import bookmarks does not work

    I am trying to import bookmarks from Safari but it does not work. I followed the online help for this but when I get to the 'Library' page after selecting 'Bookmarks' 'show all bookmarks', there is no 'import and back up' function so I cannot complete the next step. Please help with a solution. I'm running Firefox 16.0.1 on Mac OSX 10.7.5

    That icon is there.<br />
    The one that is meant is the last icon (third after the B/F buttons) on the toolbar with a star like shape and a drop down marker.
    You may have to edit the HTML file and remove the FOLDED attributes in all H3 Tags.
    *[[/questions/932927]] Firefox 14.01 not importing html bookmarks

  • USB hub does not work!  Help

    I was attempting to install a KVM switch for my G4 and G5 that required me attaching my keyboard and mouse to the usb port on the back of the monitor.
    The USB hub does not work! Monitor cable has no bent pins, and works perfectly for video with all my Mac's, G4's, G5's. The problem is I have had this monitor awhile and never tried these ports so apple won't help.
    Anyone have any suggestions why these ports don't work and if there is a fix?
    Can any one recommend a KVM switch that supports ADC, and USB so I bypass this hub.
    Thanks

    Some USB 2.0 hardware works very well w/USB 3.0 & some don't.  Suggest that you contact the sound card manufacturer & ask them.  Perhaps they can recommend a work-a-round. 
    Another user posted about the same problem some weeks ago regarding a sound card. 

  • HT1338 For the past 2 weeks I have not been able to open any small video on the yahoo page or face book. I get  Blocked Plug In. I have installed Adobe and that still does not work. Help.

    For the past 2 weeks I have not been able to open any small video on facebook or on the yahoo page . I have installed Adobe and it still dies not work. Help.

    Use "Firefox/File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit") to close Firefox if you are currently doing that by clicking the close X on the title bar.
    See "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    See "Firefox hangs when you quit it":
    *https://support.mozilla.org/kb/Firefox+hangs

  • Imported package does not exist

    Hello
    I'm importing a package com.borland.jbcl.layout.* into my java
    program to do some GUI layout but kept getting the error that the package does not exist. Can someone explain why and the solution to this problem please?
    Thanks
    Danny

    If the class you are trying to import is in a .jar file, you need to add the jar to your classpath CLASSPATH=c:\dir1\...\MyJar.jar. If the file is in a directory you need to include the base directory in the classpath CLASSPATH=c:\basedir

  • Maverick update now my login screen does not work please help.

    Hello hope you can help.  I have a 24 inch Mid 2007 Intel iMac.  It has been great until now.  I recently did the Maverick update and now my login screen does not work.  When I wake the computer up the screen appars with my picture icon.  When I click on it nothing happens.  If I click on it a second or third time the beach ball appears and nothing happens.  I have to shut the unit down with the power button and when the unit powers back up everything works normally.  Are there any suggestions out there?  I have updated the software without resolution. Is this computer too old?   Do I have to buy a new one?
    Thank you

    Your iMac can support Mavericks according to the requirements > OS X Mavericks: System Requirements
    Try a Safe Mode boot. That deletes some system caches that may help.
    Startup your Mac in Safe Mode
    A Safe Mode boot takes much longer than a normal boot so be patient.
    Once you are in Safe Mode, click Restart from the Apple () menu.
    See if there's an improvement for the login screen.

  • After the upgrade to Mozilla 32 using csv files to import data does not work anymore. What should I do?

    Hello,
    After the latest upgrade to Mozilla 32 a previously recorded imacros scirpt in which the data was being imported into mozilla from a csv file keeps erroring out. This same problem occurred with the with the upgrade to Mozilla 30 and was fixed when Mozilla was upgraded to 31. Can you please advise on how to correct the problem so that csv files can be used in conjunction with imacros scripts. I would like to point out that imacros still works without the use of csv files, but when you introduce a csv to the script the imacros does not work.
    Thank you,
    Eugene

    hello eugene, please directly contact the imacros extension developers through the means provided at their [http://forum.iopus.com/viewforum.php?f=11 forum] - they can likely give you more detailed guidance and are the only ones who can fix bugs or make necessary adjustments in the addon for new firefox versions. thank you...

  • OS X Mountain lion code does NOT work - Please help

    I bought my 2012 Macbook pro June 21 2012. I qualify for the free OS X Mountain lion upgrade. I got my emails, one with the PDF file, one with the password to it. I open up the red PDF file, enter my password and it does NOT work. I took my password to the Mac App store, clicked Quick Link, Redeem, placed my code in and it STILL DOES NOT work. PLEASE HELP!!! I need the new OS, plus Im supposed to get it for free! Its not fair how they sent me a bad code / improper instructions on how to redeem it.

    suggestion - call apple.....since we're all users here, it's hard to give you the right suggestion/answer regarding your issue...

  • My iCloud email does not work. Getting error message that i need to uncheck SSL . This does not work. Help

    icloud Email does not work. When running Connection doctor it indicates I must check or uncheck SSL. This has not fixed the problem

    iCloud email addresses (@mac.com, @me.com and @icloud.com) require SSL. Is your address an iCloud address or someone else?

  • I'M AN AMERICAN ON TEMPORARY ASSIGNMENT IN ITALY AND CANNOT GET TO ANY HELP SOURCE ONLINE OR BY THE PHONE NUMBERS LISTED ONLINE.  I'M TRYING TO RENEW MY ONE TO ONE SUPPORT PROGRAM AND THE "RENEW NOW" LINK DOES NOT WORK!  HELP!

    APPLE SENT ME AN E-MAIL WITH A LINK TO RENEW MY ONE TO ONE SUPPORT.  THE LINK DOES NOT WORK.  AFTER I LOG INTO MY APPLE ACCOUNT AND CLICK "RENEW NOW" FOR ONE TO ONE, AN ERROR MESSAGE APPEARS SAYING "PAGE NOT FOUND".  AMAZING.  WHEN I TRY TO CALL THE TOLL FREE APPLE SUPPORT NUMBER FROM MILAN, ITALY WHERE I AM NOW LIVING, IT DOESN'T WORK. THE ITALIAN SUPPORT DESK APPEARS TO BE AVAILABLE ONLY ON WEEKDAYS DURING NORMAL BUSINESS HOURS.  HOW CAN I REACH A LIVE APPLE SUPPORT PERSON?

    Start by going here - https://expresslane.apple.com/GetproductgroupList.action?locale=it_IT
    Best of luck.

  • My home button now reads "homeButton.label;" and does not work. Help. thanks...

    turned on my computer, looked up and saw this " homeButton.label;" on my home button.
    I cannot get rid of it in Tools etc and it does not work as a command. I press it to go home, in this case google, but it does nothing. At the bottom left of the page it simply says "Done".
    I am at a loss to explain it.
    Anyone?
    Thanks,
    SL

    Do you have that problem when running in the Firefox SafeMode?
    [http://support.mozilla.com/en-US/kb/Safe+Mode]
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this:
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

Maybe you are looking for